Linguistically correct Python text rendering

David Opstad opstad at batnet.com
Tue Feb 24 17:55:29 EST 2004


In article <mailman.33.1077633885.8594.python-list at python.org>,
 "Mike Maxwell" <maxwell at ldc.upenn.edu> wrote:

> Isn't this a function of whatever app you're running Python code inside (a
> terminal or something)?  E.g. could you take the output of your Python
> program as a file and display it in Yudit or a Pango app?

In an interactive Python session on the Mac, the terminal window can 
display Asian or accented Latin with no problem, so that:

>>> firstCJKChar = u"\u4e00"
>>> print firstCJKChar.encode('utf-8')

gives the correct output, the Chinese character "yi". (The terminal's 
defaults are for UTF-8 text display)

All I'm wondering is whether this odd asymmetry (between parts of 
Unicode that display correctly with no further work and parts of Unicode 
that need more active processing) is something that could be addressed 
by adding more sophistication to Python's own output formatting. The 
alternative is, as you suggest, to export Unicode text and open it with 
another application, but I want Python to shine for all languages by 
default!

Dave



More information about the Python-list mailing list