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 #1381 (closed defect: invalid)

Opened 12 years ago

Last modified 12 years ago

the missing "u": tg tg-admin shell cannot input unicode string

Reported by: beejoy Owned by: anonymous
Priority: normal Milestone: 1.0.4
Component: tg-admin (non-toolbox) Version: 1.0.2
Severity: major Keywords: unicode

Description (last modified by Chris Arndt) (diff)

\simpleblog>tg-admin shell
Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] on
Type "help", "copyright", "credits" or "license" for more information.
>>> unistr = u"你好"
>>> unistr
>>> import sys
>>> sys.getdefaultencoding()

now, we canonly work around through:

>>> utf8="你好"
>>> uni = unicode(utf8, "gb2312")

should be:

>>> unistr = u"你好"
>>> unistr

Change History

comment:1 Changed 12 years ago by Chris Arndt

  • Milestone changed from 1.0.3 to 1.0.4

Batch promoting 1.0.3 tickets to Milestone 1.0.4

comment:2 Changed 12 years ago by Chris Arndt

  • Status changed from new to closed
  • Resolution set to invalid
  • Description modified (diff)

I think you are mixing up the encoding of the terminal with the internal encoding of strings in Python here.

You terminal sends your input to the python interpreter in a certain encoding when you type in the string literal. To get a unicode string, you have to decode this literal.

This is not a TurboGears matter. Please see section "Unicode Literals in Python Source Code" in  http://www.amk.ca/python/howto/unicode.

Note: See TracTickets for help on using tickets.