A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2008-December/084362.html below:

[Python-Dev] sys.stdout.write encoding failure

[Python-Dev] sys.stdout.write encoding failure [Python-Dev] sys.stdout.write encoding failureAlexander Belopolsky alexander.belopolsky at gmail.com
Mon Dec 15 04:12:41 CET 2008
There is currently a unit test in the trunk that fails in verbose mode:

$ ./python.exe Lib/test/test_doctest.py -v
...
UnicodeEncodeError: 'ascii' codec can't encode characters in position
338-339: ordinal not in range(128)

Apparently, the problem is that stdout cannot encode non-ascii characters:

>>> sys.stdout.write(u'f\xf6\xf6')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode characters in position
1-2: ordinal not in range(128)

which is strange because

>>> sys.stdout.encoding
'UTF-8'

and print has no problem with the same string:
>>> print u'f\xf6\xf6'
föö


Where does  'ascii' codec come from?
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4