Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #1714 (closed defect: fixed)

Opened 11 years ago

Last modified 11 years ago

tg-admin shell and unicode

Reported by: mte Owned by: anonymous
Priority: normal Milestone: 1.0.x bugfix
Component: tg-admin (non-toolbox) Version:
Severity: normal Keywords:


Consider this example (written in a normal python shell, not tg-admin shell):

>>> u"č" # correct output
>>> import code
>>> sh = code.InteractiveConsole()
>>> sh.interact()
>>> u"č" # wrong output in the interactive console
>>>  (Ctrl+D)
>>> u"č" # back to normal shell with correct output

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).


interactiveshell.diff Download (635 bytes) - added by mte 11 years ago.

Change History

Changed 11 years ago by mte

comment:1 Changed 11 years ago by chrisz

  • Status changed from new to closed
  • Resolution set to fixed

Tested with Py 2.3 - 2.5. Makes sense. Applied in r4186.

comment:2 Changed 11 years ago by chrisz

Sorry, the update happened in r4187 (forgot to add a message).

Note: See TracTickets for help on using tickets.