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


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

Re: Unicode, stdout, and stderr

Started byTerry Reedy <tjreedy@udel.edu>
First post2014-07-22 13:38 -0400
Last post2014-07-22 13:38 -0400
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 Terry Reedy <tjreedy@udel.edu> - 2014-07-22 13:38 -0400

#75009 — Re: Unicode, stdout, and stderr

FromTerry Reedy <tjreedy@udel.edu>
Date2014-07-22 13:38 -0400
SubjectRe: Unicode, stdout, and stderr
Message-ID<mailman.12187.1406050750.18130.python-list@python.org>
On 7/22/2014 2:18 AM, Frank Millman wrote:
> Hi all
>
> This is not important, but I would appreciate it if someone could explain
> the following, run from cmd.exe on Windows Server 2003 -
>
> C:\>python
> 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

On Windows, at least, the Idle gui generally handles unicode (certainly 
the BMP) much better than the interpreter command prompt interface.

 >>> x = '\u2119'
 >>> x
'ℙ'
 >>> print(x)
ℙ

-- 
Terry Jan Reedy

[toc] | [standalone]


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


csiph-web