tags:

views:

241

answers:

1

I'm using a Google Gears Worker to submt a POST httprequest
(using var request = google.gears.factory.create('beta.httprequest'); )

with a parameter containing the string
"bford%20%24%23%26!%3F%40%20%E5%BE%B3%E5%8A%9B%E5%9F%BA%E5%BD%A6"

but the Django HttpRequest is receiving it as
"bford $#&!?@ å¾³å\u008a\u009bå\u009fºå½¦"

How do I specify to one or the other of the parties in the transaction to leave it untranslated?

A: 

Check the HttpRequest.encoding and the DEFAULT_CHARSET settings. Judging by the encoded value, this should be UTF-8 (which is indeed usually the right thing).

You can get the ‘untranslated’ (with %s still in) value by looking at the input stream (for POST) or environ QUERY_STRING (for GET) and decoding it manually, but it would be better to fix Django's incorrect string-to-unicode decoding really.

As I understand it, Django 1.0 should default to using UTF-8, so I'm not sure why it's not in your case.

bobince