Chapter 20.2.1. SQLObject and Unicode

SQLObject contains _UnicodeCol_, which provides transparent encoding/decoding of Unicode values. It’s just like _StringCol_ (in fact, it’s a subclass of it) except that SQLObject encodes Python Unicode strings on the way to the database and decodes them on the way back. By default, UTF-8 encoding in the database table is assumed, which usually “just works.”

If you have the following SQLObject declaration, you’ll get a database column that holds Unicode strings in UTF-8 form:

class T1(SQLObject):
    name = UnicodeCol(length=40, alternateID=True)

The one caveat here is that your database of choice, and your database driver of choice, have to handle UTF-8. SQLObject helps you out where it can; but it ...

Get Rapid Web Applications with TurboGears: Using Python to Create Ajax-Powered Sites now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.