-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Martin Bialasinski wrote:
> Looks like one needs a function that takes the result from
> getResponseHeader() and reconstructs the UTF-8 encoded string from the
> bytes returned by charCodeAt().
Based on your observations and following this suggestion I'll settle
this discussion to something like "OK, if it's bytes they get, bytes
I'll handle". So, I'll just drop UCS (6 times longer length it's not
nice after all) and keep on sending proper UTF-8 data, which I'll handle
in JS by decoding those bytes back to UTF-8.

I'll be overriding Prototype's "evalJSON" with this one:

Ajax.Request.prototype.evalJSON = function() {
  var json = this.header('X-JSON') || '{}';
  var jutf = decodeURIComponent(escape(json));
  if (jutf.length < json.length) {
    json = jutf;
  }
  try {
    return eval('(' + json + ')');
  } catch (e) {
    return {};
  }
};

cheers
- --
Marius Feraru
-----BEGIN PGP SIGNATURE-----

iD8DBQFFEesctZHp/AYZiNkRAtG5AJ9UGD8jIzAsdq/1ZYJjqWTklWCC2gCfaFUV
vIcfQLL64yB5KHXBYXQ3DR4=
=9Gwp
-----END PGP SIGNATURE-----

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to rubyonrails-spinoffs@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs
-~----------~----~----~----~------~----~------~--~---

Reply via email to