Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #41265
| From | Thomas Heller <theller@ctypes.org> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: Unicode |
| Date | 2013-03-15 12:43 +0100 |
| Message-ID | <aqgfq4FjfglU1@mid.individual.net> (permalink) |
| References | <aqgcesFio46U1@mid.individual.net> <5142feca$0$29965$c3e8da3$5496439d@news.astraweb.com> |
Am 15.03.2013 11:58, schrieb Steven D'Aprano: > On Fri, 15 Mar 2013 11:46:36 +0100, Thomas Heller wrote: [Windows: Problems with unicode output to console] > You can isolate the error by noting that the second one only raises an > exception when you try to print it. That suggests that the problem is > that it contains a character which is not defined in your terminal's > codepage. So let's inspect the strings more carefully: > > > py> a = u"µm" > py> b = u"\u03bcm" > py> a == b > False > py> ord(a[0]), ord(b[0]) > (181, 956) > py> import unicodedata > py> unicodedata.name(a[0]) > 'MICRO SIGN' > py> unicodedata.name(b[0]) > 'GREEK SMALL LETTER MU' > > Does codepage 850 include Greek Small Letter Mu? The evidence suggests it > does not. > > If you can, you should set the terminal's encoding to UTF-8. That will > avoid this sort of problem. Thanks for the clarification. For the archives: Setting the console codepage to 65001 and the font to lucida console helps. Thomas
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Unicode Thomas Heller <theller@ctypes.org> - 2013-03-15 11:46 +0100
Re: Unicode Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-03-15 10:58 +0000
Re: Unicode Thomas Heller <theller@ctypes.org> - 2013-03-15 12:43 +0100
Re: Unicode Duncan Booth <duncan.booth@invalid.invalid> - 2013-03-15 11:02 +0000
csiph-web