|forcing UTF8 data inside django||Victor Ng||12/10/06 8:02 PM|
The unicode problem seems to creep up in this list a lot, so here's
My particular problem is that I need to be able to deal with Unicode
This is a piece of middleware that I'm using to force all incoming
Setting that meta tag, along with explicitly seting the
This has the advantage over a 'full' unicode conversion of Django
Anyway, I hope this is of use to people.
The utf8encode function is probably overly paranoid, but well... I
1 import types
|Re: forcing UTF8 data inside django||mezhaka||12/11/06 2:44 AM|
What was your motivation to create all this?
|Re: forcing UTF8 data inside django||Gábor Farkas||12/11/06 4:30 AM|
Victor Ng wrote:
well, from my experiences, the most important thing is the content-type
also, may i ask, why such a paranoid way of working with GET/POST?
so if you send to the browser an utf-8 page, it's submitted data is
|Re: forcing UTF8 data inside django||Victor Ng||12/11/06 8:08 AM|
First off, I just realized that the code I posted earlier has a small bug.
Line 17 should've read:
17 for key, vallist in cgiargs.lists():
the old code used 'items()' which only pulls a single value out of
On to unicode....
The reason I'm paranoid about handling GET/POST data is because MSIE
Here's two good references:
Basically, IE ignores the content-type header and figures out the
So sometimes, IE guesses wrong - and you get garbage if you just use
victor "MSIE is a four letter word" ng
On 12/11/06, Gábor Farkas <ga...@nekomancer.net> wrote:
|Re: forcing UTF8 data inside django||Victor Ng||12/11/06 8:17 AM|
I don't have mysql5 to test with right now, but I have tested my stuff
My usecase is probably like yours - I need multilingual support since
|Re: forcing UTF8 data inside django||favo||12/12/06 8:08 AM|
I think you'd better enforce de/encoding to settings.DEFAULT_CHARSET in
the middleware. not hardcode utf8.
|Re: forcing UTF8 data inside django||Victor Ng||12/12/06 2:27 PM|
Unfortunately, not all charsets will support all unicode characters,
so really, the fact that DEFAULT_CHARSET configurable is mostly a moot
point for me. For example, latin1 won't let me encode asian
I honestly can't think of a good reason to do anything other than UTF8
On 12/12/06, favo <Favo...@gmail.com> wrote: