Consider this example (written in a normal python shell, not tg-admin shell):
>>> u"č" # correct output
u'\u010d'
>>> import code
>>> sh = code.InteractiveConsole()
>>> sh.interact()
(InteractiveConsole)
>>> u"č" # wrong output in the interactive console
u'\xc4\x8d'
>>> (Ctrl+D)
>>> u"č" # back to normal shell with correct output
u'\u010d'
Clearly, tg-admin uses the same interactive console which causes some trouble when inserting things in Unicode() database fields. If I write:
>>> MyNiceSqlClass(myunicodefield=u'č')
I get strange garbled characters in db. If I write:
>>> MyNiceSqlClass(myunicodefield='č')
it's fine with SQLObject, SQLAlchemy issues a warning. Database entries look ok but this is bad practice and a bad workaround in my opinion.
The patch attached works fine for me (I couldn't get IPython to work with utf8 so no patch for that).