Simon Willison wrote: > > On 19 Jul 2006, at 13:19, Ivan Sagalaev wrote: > >> Talking about QUERY_STRING... While the string itself is in ASCII >> it has >> urlencoded data and there the encoding matters. As fas as I can see in >> practice browsers tend to encode those data in the same encoding as >> the >> page from where those links come. So for decoding urlencoded >> QUERY_STRING I think it's reasonable to use DEFAULT_CHARSET. > > We shouldn't be decoding QUERY_STRING in request.META at all - we > should leave it as urlencoded ASCII. request.META is meant to give > you access to the 'raw data' from the browser.
i'm a little lost here. you're saying that: 1. request.META should contain raw bytestrings (like it's currently) 2. request.META should contain unicode strings. for QUERY_STRING, we should convert it to unicode using the 'ascii' charset. and we should not url-decode it. ? > > We do however need to take charset stuff in to account when creating > the request.GET and request.POST arrays - that's where the query > string should be parsed and unencoded and turned in to a set of name/ > value unicode strings. The character encoding used for this data > should be specified in a browser header; as a general rule, browsers > submit data back to the server using the same character encoding that > the page with the form on was sent as. yes, for GET we should use the DEFAULT_CHARSET (the one we used to send out the page), and for POST i have to check but i think the browser is either sending the charset in content-type or not. if he sends we should use it and if not => DEFAULT_CHARSET. gabor --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-developers -~----------~----~----~----~------~----~------~--~---
