Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #74976 > unrolled thread

Re: Unicode, stdout, and stderr

Started by"Frank Millman" <frank@chagford.com>
First post2014-07-22 09:06 +0200
Last post2014-07-22 09:06 +0200
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Unicode, stdout, and stderr "Frank Millman" <frank@chagford.com> - 2014-07-22 09:06 +0200

#74976 — Re: Unicode, stdout, and stderr

From"Frank Millman" <frank@chagford.com>
Date2014-07-22 09:06 +0200
SubjectRe: Unicode, stdout, and stderr
Message-ID<mailman.12165.1406012790.18130.python-list@python.org>
"Lele Gaifax" <lele@metapensiero.it> wrote in message 
news:87lhrl28ie.fsf@nautilus.nautilus...
> "Frank Millman" <frank@chagford.com> writes:
>
>> Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 10:38:22) [MSC v.1600 32 
>> bit
>> (In
>> tel)] on win32
>> Type "help", "copyright", "credits" or "license" for more information.
>>>>> x = '\u2119'
>>>>> x  # this uses stderr
>> '\u2119'
>>>>> print(x)  # this uses stdout
>> Traceback (most recent call last):
>>   File "<stdin>", line 1, in <module>
>>   File "C:\Python34\lib\encodings\cp437.py", line 19, in encode
>>     return codecs.charmap_encode(input,self.errors,encoding_map)[0]
>> UnicodeEncodeError: 'charmap' codec can't encode character '\u2119' in
>> position
>> 0: character maps to <undefined>
>>>>>
>
> No, both statements actually emit noise on the standard output, but the
> former prints the *repr* of the string, the latter tries to encode it to
> CP437, which you console seems to be using.
>

Thanks, Lele, but I don't think that is quite right - see my separate 
response to Steven

Frank


[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web