patrick.just4fun at gmail.com
Wed Mar 3 14:32:22 CET 2010
> Mmm ok. So all strings in the app are unicode by default?
Depends on your python version. If you use python 2.x, you have to use a
u before the string:
s = u'Hallo World'
> Do you know if there is a function/method i can use to check encoding of
> a string?
AFAIK such a function doesn't exist. Python3 solves this by using
unicode strings by default.
> Patrick, ok. I should check if it's possible to save unicode strings in
> the DB.
It is more an issue of your database adapter, than of your database.
> Do you think i'd better set my db to utf8? I don't need latin1, it's
> just the default value.
I think the encoding of the db doesn't matter much in this case, but I
would prefer utf-8 over latin-1. If you get an utf-8 encoded raw byte
string you call .decode('utf-8'). In case of an latin-1 encoded string
you call .decode('latin1')
More information about the Tutor