Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #74976
| From | "Frank Millman" <frank@chagford.com> |
|---|---|
| Subject | Re: Unicode, stdout, and stderr |
| Date | 2014-07-22 09:06 +0200 |
| References | <lqkvn0$ptp$1@ger.gmane.org> <87lhrl28ie.fsf@nautilus.nautilus> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.12165.1406012790.18130.python-list@python.org> (permalink) |
"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
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Unicode, stdout, and stderr "Frank Millman" <frank@chagford.com> - 2014-07-22 09:06 +0200
csiph-web