Character encoding & the copyright symbol

Dave Angel davea at ieee.org
Thu Aug 6 22:26:11 CEST 2009


Robert Dailey wrote:
> Hello,
>
> I'm loading a file via open() in Python 3.1 and I'm getting the
> following error when I try to print the contents of the file that I
> obtained through a call to read():
>
> UnicodeEncodeError: 'charmap' codec can't encode character '\xa9' in
> position 1650: character maps to <undefined>
>
> The file is defined as ASCII and the copyright symbol shows up just
> fine in Notepad++. However, Python will not print this symbol. How can
> I get this to work? And no, I won't replace it with "(c)". Thanks!
>
>   
I see others have alerted you to changes needed in stdout, which is 
ASCII coded by default.

But I wanted to comment on the (c) remark.  If you're in the US, that's 
the wrong abbreviation for copyright.  The only recognized abbreviation 
is (copr).

DaveA



More information about the Python-list mailing list