[Tutor] UNICODE BEST RESPONSE

anil maran anilmrn at yahoo.com
Sun Sep 24 06:41:08 CEST 2006


Hum, I don't have any problems, and I don't do
anything special ...

- I use PostgreSQL, so I created my database using
UTF-8 encoding.
- my Python modules start with "# -*- coding: utf-8
-*-".
- all my modules and my templates are utf-8 encoded (I
use Vim, so I
use ":set encoding=utf-8", but it should work with any
good
text-editor).

The only 'encoding trick' I use is when I want to
print an exception,
catched from a bad database query. I need to do
something like this :

===============
except Exception, detail:
print "blablabla : %s" % str(detail).decode('latin1')
return
===============

... since the exception message (which is in french)
seems to be latin1
encoded.

That's all :)

pythonic Anil

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


More information about the Tutor mailing list