Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #76360
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2014-08-15 01:25 -0700 |
| References | <4dd67a80-b466-4866-ab67-d9a94c0b7ddf@googlegroups.com> <53ecba3e$0$1989$426a74cc@news.free.fr> <d460fa66-e881-4b80-9f86-cf82b3aa45ca@googlegroups.com> <53eccc08$0$2932$426a34cc@news.free.fr> <53ecd406$0$29971$c3e8da3$5496439d@news.astraweb.com> |
| Message-ID | <c5b27af5-ce27-4cbd-b4bd-01f50b8d129f@googlegroups.com> (permalink) |
| Subject | Re: Unable to run print('Réussi') on windows and on linux |
| From | wxjmfauth@gmail.com |
Le jeudi 14 août 2014 17:21:41 UTC+2, Steven D'Aprano a écrit :
>
> * Fix your system to use UTF-8 by default.
>
>
%%%%%
Sorry, but no. This is not a correct way of working.
>>> u = 'abc需αб'
>>> u; print(u)
'abc需αб'
abc需αб
>>> sys.stdout.encoding = 'cp437'
>>> print(u)
Traceback (most recent call last):
File "<eta last command>", line 1, in <module>
File "D:\jm\jmpy\eta\eta41beta1\etastdio.py", line 193, in write
s = s.encode(self.pencoding).decode('cp1252')
File "c:\python32\lib\encodings\cp437.py", line 12, in encode
return codecs.charmap_encode(input,errors,encoding_map)
UnicodeEncodeError: 'charmap' codec can't encode characters in position 4-5:
character maps to <undefined>
>>> print(u.encode(sys.stdout.encoding, 'replace'))
abcé??α?
>>> sys.stdout.encoding = 'utf-16-le'
>>> print(u)
a b c é S¬ ±1
>>> print(u.encode(sys.stdout.encoding, 'replace'))
abc需αб
>>> # etc
jmf
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Unable to run print('Réussi') on windows and on linux marc.vanhoomissen@gmail.com - 2014-08-14 05:35 -0700
Re: Unable to run print('Réussi') on windows and on linux YBM <ybmess@nooos.fr.invalid> - 2014-08-14 15:31 +0200
Re: Unable to run print('Réussi') on windows and on linux marc.vanhoomissen@gmail.com - 2014-08-14 07:04 -0700
Re: Unable to run print('Réussi') on windows and on linux Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-08-14 15:38 +0100
Re: Unable to run print('Réussi') on windows and on linux YBM <ybmess@nooos.fr.invalid> - 2014-08-14 16:47 +0200
Re: Unable to run print('Réussi') on windows and on linux Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-08-15 01:21 +1000
Re: Unable to run print('Réussi') on windows and on linux Ian Kelly <ian.g.kelly@gmail.com> - 2014-08-14 10:12 -0600
Re: Unable to run print('Réussi') on windows and on linux wxjmfauth@gmail.com - 2014-08-15 01:25 -0700
Re: Unable to run print('Réussi') on windows and on linux Vincent Vande Vyvre <vincent.vande.vyvre@telenet.be> - 2014-08-14 16:46 +0200
Re: Unable to run print('Réussi') on windows and on linux Vincent Vande Vyvre <vincent.vande.vyvre@telenet.be> - 2014-08-14 15:22 +0200
Re: Unable to run print('Réussi') on windows and on linux marc.vanhoomissen@gmail.com - 2014-08-14 07:01 -0700
Re: Unable to run print('Réussi') on windows and on linux Peter Otten <__peter__@web.de> - 2014-08-14 18:00 +0200
Re: Unable to run print('Réussi') on windows and on linux Anssi Saari <as@sci.fi> - 2014-08-14 17:36 +0300
Re: Unable to run print('Réussi') on windows and on linux wxjmfauth@gmail.com - 2014-08-15 01:23 -0700
csiph-web