A RetroSearch Logo

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

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2009-January/085612.html below:

[Python-Dev] Python 3.0.1 (io-in-c)

[Python-Dev] Python 3.0.1 (io-in-c)Paul Moore p.f.moore at gmail.com
Wed Jan 28 19:20:08 CET 2009
2009/1/28 "Martin v. Löwis" <martin at v.loewis.de>:
>>>>> print(open("a1").read())
>> Traceback (most recent call last):
>>   File "<stdin>", line 1, in <module>
>>   File "D:\Apps\Python30\lib\io.py", line 1491, in write
>>     b = encoder.encode(s)
>>   File "D:\Apps\Python30\lib\encodings\cp850.py", line 19, in encode
>>     return codecs.charmap_encode(input,self.errors,encoding_map)[0]
>> UnicodeEncodeError: 'charmap' codec can't encode character '\u0153' in
>> position 1: character maps to <undefined>
>
> Looks right to me.

I don't see why. I wrote the file from the console (cp850), read it in
Python using the default encoding (which I would expect to match the
console encoding), wrote it to sys.stdout (which I would expect to use
the console encoding).

How did the character end up not being encodable, when I've only used
one encoding throughout? (And if my assumptions about the encodings
used are wrong at some point, that's what I'm suggesting is the
error).

Paul.
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