django
- 07/01/2010
[Quickie] Django - Forcing the encoding of strings
I had problems with accented strings coming from a webservice. Everything was working perfectly!! minus the accents in words ...
I searched for a long time in oracle and could not make it work. I had a word with @ kplaube and he gave me this tip.
To force the encoding of a string in Django use:
- , strings_only= False , errors= 'replace' ) force_unicode (s, encoding = 'utf-8', strings_only = False, errors = 'replace')
Done it all worked chubby!
Ref: # Useful http://docs.djangoproject.com/en/dev/ref/unicode/-utility-functions
Credits: @ kplaube




4 Comments to "[Quickie] Django - Forcing the encoding of strings"
Hey doctor, dropped the PHP time?
're Already hooked on the python, or even turning back?
Sincerely,
By diego (15 comments) on 07/01/2010
I left nothing heehhe
I love PHP yet, but as I'm having a nice touch with Python / Django I'll post some stuff related
A big hug!
By Marcelo Sabadini (101 comments) on 08/01/2010
Oops, this tip is good. Do not know
Thanks Marcelo
By Francis Souza (3 comments) on 23/01/2010
That broke a galhão heheheheh
By Marcelo Sabadini (101 comments) on 28/01/2010