unable to print Unicode characters in Python 3

Benjamin Kaplan benjamin.kaplan at case.edu
Tue Jan 27 01:57:11 CET 2009

On Mon, Jan 26, 2009 at 5:42 PM, "Martin v. Löwis" <martin at v.loewis.de>wrote:

> > I was hoping to find something that allows me to print any Unicode
> > character on the console.
> You will have to debug the Python interpreter to find out what's
> going wrong in code page 65001. Nobody has ever resolved that mystery,
> although it's been known for some time.

Well, the first step would be to tell Python that there is a code page
65001. On Python 2.6, I get a LookupError for an unknown encoding after
doing "chcp 65001". I checked the list of aliases in Python 3 and there was
no entry for cp65001.

Python 2.6.1 (r261:67517, Dec  4 2008, 16:51:00) [MSC v.1500 32 bit (Intel)]
Type "help", "copyright", "credits" or "license" for more information.
>>> print u'hello'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
LookupError: unknown encoding: cp65001

> If you merely want to see *something* (and not actually the glyph
> for the character (*)):
> py> print(ascii('\u20ac'))
> '\u20ac'
> should work fine.
> Regards,
> Martin
> (*) Windows doesn't support displaying *all* unicode characters even
> in code page 65001, nor is it reasonable to expect it to. It can, at
> best, only display those characters it has glyphs for in the font
> that it is using. As Unicode constantly evolves, the fonts necessarily
> get behind. Plus, in a fixed-size font, some characters just don't
> render too well.
> --
> http://mail.python.org/mailman/listinfo/python-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090126/4d392982/attachment.html>

More information about the Python-list mailing list