Unicode in Python micro-recipe : from MySQL to webpage via Cheetah

Very easy:

- start by adding the default-character-set=utf8 in your MySQL configuration file and restart the database server - apply this recipe from Activestate Python Cookbook (“guaranteed conversion to unicode or byte string”) - inside the Cheetah template, use the ReplaceNone filter:

#filter ReplaceNone


#end filter

in order to prevent escaping non-ASCII characters.

Now. That’s better.