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

Martin Bialasinski wrote:
> The value of the X-JSON header is eval()'ed. Strings in JS are UTF-8 
> encoded.
If I wouldn't know about this, why do you think I mentioned UCS?!

> Encode the X-JSON value as UTF-8 and everything will be just fine.
I thought it was already obvious from my previous message that data _is_
UTF-8 encoded.

I suppose my previous message wasn't eloquent enough, so I'll reiterate.

Request:
  new Ajax.Request('/echo', {
    method:     'get',
    parameters: 'a=ß;b=ç',
    onSuccess:  function(req, json) {
      ['X-JSON', 'X-JSON-UCS'].each(function(h) {
        console.debug( h + ': ', req.getResponseHeader(h) );
      });
    }
  });

"/echo" it's just a simple "JSON echo" test, encoding received query
params into a JSON object.

Scraping some gecko debugging messages:
...
- -1210520688[9c18b48]: nsHttpTransaction::ParseLine [X-JSON-UCS:
{"a":"\u00df","_":"","b":"\u00e7"}]
- -1210520688[9c18b48]: nsHttpTransaction::ParseLine [X-JSON:
{"a":"ß","_":"","b":"ç"}]
...
- -1210520688[9c18b48]: http response [
- -1210520688[9c18b48]:   HTTP/1.1 200 OK
...
- -1210520688[9c18b48]:   X-JSON-UCS: {"a":"\u00df","_":"","b":"\u00e7"}
- -1210520688[9c18b48]:   X-JSON: {"a":"ß","_":"","b":"ç"}
...
- -1210520688[9c18b48]: ]
...

This proves Gecko properly processes HTTP headers (at nsHttp level)
... BUT!...
checking response headers (with anything JS based, e.g. FireBug,
LiveHTTPHeaders, etc), I get:

X-JSON-UCS: {"a":"\u00df","_":"","b":"\u00e7"}
X-JSON: {"a":"ß","_":"","b":"ç"}

Which obviously is wrong (the 'X-JSON' sample) :(

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

iD8DBQFFEUJetZHp/AYZiNkRAlWRAJ0cscsZ4U5kAfan+VFJq5X3YAPWSACdEUXv
kT/qAn0KhA4ipfHco7y2fcs=
=Xnki
-----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