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 10 years ago

Last modified 9 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: 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

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

Change History

Changed 10 years ago by mte

comment:1 Changed 9 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 9 years ago by chrisz

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

Note: See TracTickets for help on using tickets.