Ticket #1714 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

tg-admin shell and unicode

Reported by: mte Assigned to: 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 (0.6 kB) - added by mte on 02/07/08 01:41:49.

Change History

02/07/08 01:41:49 changed by mte

  • attachment interactiveshell.diff added.

03/01/08 10:09:17 changed by chrisz

  • status changed from new to closed.
  • resolution set to fixed.

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

03/01/08 10:11:26 changed by chrisz

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