Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #75721
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2014-08-05 00:38 -0700 |
| References | (1 earlier) <mailman.12626.1407141602.18130.python-list@python.org> <namvm7de6lau$.kcjldqj76p4m$.dlg@40tude.net> <mailman.12650.1407179849.18130.python-list@python.org> <1g317psebknmz.3r1n3q3igpkt.dlg@40tude.net> <mailman.12658.1407199889.18130.python-list@python.org> |
| Message-ID | <e30209b6-d584-4f22-800e-b2b82674d44f@googlegroups.com> (permalink) |
| Subject | Re: cmd.exe on WIndows - problem with displaying some Unicode characters |
| From | wxjmfauth@gmail.com |
Code pages, console, codings, characters, ...
From my GUI interactive interpreter mimicking a "dos box".
Question marks instead of .notdef glyph (ev. replaced chars)
displayed in a real console. (tested)
%%%%%%%%%%%%%
>>> # the gui
>>> sys.stdout.encoding
'<unicode>'
>>> # the cp852 available chars
>>> a = ''
>>> for i in range(0x20, 0x3000):
... try:
... a = a + chr(i).encode('cp852').decode('cp852')
... except Exception:
... pass
...
>>> len(a)
224
>>> a
'
!"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVW
XYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~\x7f\xa0¤§¨«¬\xa
d°´¸»ÁÂÄÇÉËÍÎÓÔÖ×ÚÜÝßáâäçéëíîóôö÷úüýĂ㥹ĆćČčĎďĐđĘęĚěĹ弾
ŁłŃńŇňŐőŔŕŘřŚśŞşŠšŢţŤťŮůŰűŹźŻżŽžˇ˘˙˛˝─│┌┐└┘├┤┬┴┼═║╔╗╚╝╠╣
╦╩╬▀▄█░▒▓■'
>>> # changing the console code page
>>> sys.stdout.encoding ='cp852'
>>> sys.stdout.encoding
'cp852'
>>> # some cp852 strings
>>> s = """\
... ┌──────────────────────────────────────────────────────────┐
... │abcúüýĂ㥹ĆćČčĎďĐđĘęĚěĹĺĽľŁłŃńŇňŐőŔŕŘřŚśŞşŠšŢţŤťŮůŰűŹźŻżŽž│
... └──────────────────────────────────────────────────────────┘"""
>>> s2 = """\
... ╔══════════════════════════════════════════════════════════╗
... ║abcúüýĂ㥹ĆćČčĎďĐđĘęĚěĹĺĽľŁłŃńŇňŐőŔŕŘřŚśŞşŠšŢţŤťŮůŰűŹźŻżŽž║
... ╚══════════════════════════════════════════════════════════╝"""
>>> print(s)
┌──────────────────────────────────────────────────────────┐
│abcúüýĂ㥹ĆćČčĎďĐđĘęĚěĹĺĽľŁłŃńŇňŐőŔŕŘřŚśŞşŠšŢţŤťŮůŰűŹźŻżŽž│
└──────────────────────────────────────────────────────────┘
>>> print(s2)
╔══════════════════════════════════════════════════════════╗
║abcúüýĂ㥹ĆćČčĎďĐđĘęĚěĹĺĽľŁłŃńŇňŐőŔŕŘřŚśŞşŠšŢţŤťŮůŰűŹźŻżŽž║
╚══════════════════════════════════════════════════════════╝
>>> # changing and using cp437...
>>> # with cp852 chars
>>> sys.stdout.encoding = 'cp437'
>>> sys.stdout.encoding
'cp437'
>>> print(s)
┌──────────────────────────────────────────────────────────┐
│abcúü?????????????????????????????????????????????????????│
└──────────────────────────────────────────────────────────┘
>>> print(s2)
╔══════════════════════════════════════════════════════════╗
║abcúü?????????????????????????????????????????????????????║
╚══════════════════════════════════════════════════════════╝
>>> # or cp1252...
>>> sys.stdout.encoding = 'cp1252'
>>> sys.stdout.encoding
'cp1252'
>>> print(s)
????????????????????????????????????????????????????????????
?abcúüý????????????????????????????????????Šš????????????Žž?
????????????????????????????????????????????????????????????
>>> print(s2)
????????????????????????????????????????????????????????????
?abcúüý????????????????????????????????????Šš????????????Žž?
????????????????????????????????????????????????????????????
>>> # reset
>>> sys.stdout.encoding = '<unicode>'
>>> sys.stdout.encoding
'<unicode>'
>>> print(s2)
╔══════════════════════════════════════════════════════════╗
║abcúüýĂ㥹ĆćČčĎďĐđĘęĚěĹĺĽľŁłŃńŇňŐőŔŕŘřŚśŞşŠšŢţŤťŮůŰűŹźŻżŽž║
╚══════════════════════════════════════════════════════════╝
>>>
>>> # end
>>>
jmf
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
cmd.exe on WIndows - problem with displaying some Unicode characters Wiktor <look@signature.invalid> - 2014-08-04 00:52 +0200
Re: cmd.exe on WIndows - problem with displaying some Unicode characters Chris Angelico <rosuav@gmail.com> - 2014-08-04 09:08 +1000
Re: cmd.exe on WIndows - problem with displaying some Unicode characters Christian Gollwitzer <auriocus@gmx.de> - 2014-08-04 22:35 +0200
Re: cmd.exe on WIndows - problem with displaying some Unicode characters Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-08-04 00:20 +0100
Re: cmd.exe on WIndows - problem with displaying some Unicode characters Andrew Berg <aberg010@my.hennepintech.edu> - 2014-08-03 18:25 -0500
Re: cmd.exe on WIndows - problem with displaying some Unicode characters Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-08-04 00:29 +0100
Re: cmd.exe on WIndows - problem with displaying some Unicode characters Chris Angelico <rosuav@gmail.com> - 2014-08-04 09:39 +1000
Re: cmd.exe on WIndows - problem with displaying some Unicode characters Chris Angelico <rosuav@gmail.com> - 2014-08-04 10:14 +1000
Re: cmd.exe on WIndows - problem with displaying some Unicode characters Glenn Linderman <v+python@g.nevcal.com> - 2014-08-03 17:17 -0700
Re: cmd.exe on WIndows - problem with displaying some Unicode characters wxjmfauth@gmail.com - 2014-08-04 01:47 -0700
Re: cmd.exe on WIndows - problem with displaying some Unicode characters Glenn Linderman <v+python@g.nevcal.com> - 2014-08-03 21:14 -0700
Re: cmd.exe on WIndows - problem with displaying some Unicode characters Andrew Berg <aberg010@my.hennepintech.edu> - 2014-08-04 00:06 -0500
Re: cmd.exe on WIndows - problem with displaying some Unicode characters Terry Reedy <tjreedy@udel.edu> - 2014-08-04 04:39 -0400
Re: cmd.exe on WIndows - problem with displaying some Unicode characters Wiktor <look@signature.invalid> - 2014-08-04 17:00 +0200
Re: cmd.exe on WIndows - problem with displaying some Unicode characters Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de> - 2014-08-04 17:43 +0200
Re: cmd.exe on WIndows - problem with displaying some Unicode characters Wiktor <look@signature.invalid> - 2014-08-04 18:48 +0200
Re: cmd.exe on WIndows - problem with displaying some Unicode characters Chris Angelico <rosuav@gmail.com> - 2014-08-05 03:06 +1000
Re: cmd.exe on WIndows - problem with displaying some Unicode characters Wiktor <look@signature.invalid> - 2014-08-04 19:22 +0200
Re: cmd.exe on WIndows - problem with displaying some Unicode characters Terry Reedy <tjreedy@udel.edu> - 2014-08-04 15:43 -0400
Re: cmd.exe on WIndows - problem with displaying some Unicode characters Terry Reedy <tjreedy@udel.edu> - 2014-08-04 15:17 -0400
Re: cmd.exe on WIndows - problem with displaying some Unicode characters Wiktor <look@signature.invalid> - 2014-08-04 22:24 +0200
Re: cmd.exe on WIndows - problem with displaying some Unicode characters Akira Li <4kir4.1i@gmail.com> - 2014-08-05 04:51 +0400
Re: cmd.exe on WIndows - problem with displaying some Unicode characters wxjmfauth@gmail.com - 2014-08-05 00:38 -0700
Re: cmd.exe on WIndows - problem with displaying some Unicode characters Wiktor <look@signature.invalid> - 2014-08-05 11:39 +0200
Re: cmd.exe on WIndows - problem with displaying some Unicode characters Chris Angelico <rosuav@gmail.com> - 2014-08-05 06:11 +1000
Re: cmd.exe on WIndows - problem with displaying some Unicode characters giacomo boffi <g@boffi.net> - 2014-08-04 22:53 +0200
Re: cmd.exe on WIndows - problem with displaying some Unicode characters Chris “Kwpolska” Warrick <kwpolska@gmail.com> - 2014-08-04 10:46 +0200
Re: cmd.exe on WIndows - problem with displaying some Unicode characters Glenn Linderman <v+python@g.nevcal.com> - 2014-08-04 02:46 -0700
Re: cmd.exe on WIndows - problem with displaying some Unicode characters Glenn Linderman <v+python@g.nevcal.com> - 2014-08-04 02:53 -0700
Re: cmd.exe on WIndows - problem with displaying some Unicode characters Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de> - 2014-08-04 12:24 +0200
Re: cmd.exe on WIndows - problem with displaying some Unicode characters Andrew Berg <aberg010@my.hennepintech.edu> - 2014-08-04 05:33 -0500
Re: cmd.exe on WIndows - problem with displaying some Unicode characters Glenn Linderman <v+python@g.nevcal.com> - 2014-08-04 11:04 -0700
Re: cmd.exe on WIndows - problem with displaying some Unicode characters Glenn Linderman <v+python@g.nevcal.com> - 2014-08-04 11:15 -0700
Re: cmd.exe on WIndows - problem with displaying some Unicode characters Grant Edwards <invalid@invalid.invalid> - 2014-08-04 19:30 +0000
Re: cmd.exe on WIndows - problem with displaying some Unicode characters Terry Reedy <tjreedy@udel.edu> - 2014-08-04 15:25 -0400
Re: cmd.exe on WIndows - problem with displaying some Unicode characters Tony the Tiger <tony@tiger.invalid> - 2014-08-05 20:26 +0000
Re: cmd.exe on WIndows - problem with displaying some Unicode characters Grant Edwards <invalid@invalid.invalid> - 2014-08-05 20:41 +0000
Re: cmd.exe on WIndows - problem with displaying some Unicode characters Wiktor <look@signature.invalid> - 2014-08-06 00:16 +0200
Re: cmd.exe on WIndows - problem with displaying some Unicode characters Tony the Tiger <tony@tiger.invalid> - 2014-08-06 18:27 +0000
Re: cmd.exe on WIndows - problem with displaying some Unicode characters wxjmfauth@gmail.com - 2014-08-05 23:30 -0700
csiph-web