Ticket #1714 (closed defect: fixed)
tg-admin shell and unicode
Reported by: | mte | Owned by: | anonymous |
---|---|---|---|
Priority: | normal | Milestone: | 1.0.x bugfix |
Component: | tg-admin (non-toolbox) | Version: | 1.0.4.2 |
Severity: | normal | Keywords: | |
Cc: |
Description
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).
Attachments
Change History
Note: See
TracTickets for help on using
tickets.