This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Error printing UTF-8 decoded text
Type: crash Stage:
Components: Interpreter Core Versions: Python 3.1
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: grace
Priority: normal Keywords:

Created on 2009-02-14 21:33 by grace, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg82120 - (view) Author: Lovely Grace (grace) Date: 2009-02-14 21:33
The following code fails on the print command (see error message bellow
the code). I use windows and run the code under command prompt env.

import urllib.request
if __name__ == "__main__":
    sock =
    htmlSource =

    htmlSource = htmlSource.decode("utf-8", "strict")

Error message:
Traceback (most recent call last):
  File "", line 68, in <module>
  File "C:\Python30\lib\", line 1494, in write
    b = encoder.encode(s)
  File "C:\Python30\lib\encodings\", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_map)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u2014' in
position 280: character maps to <undefined>
msg82121 - (view) Author: Lovely Grace (grace) Date: 2009-02-14 21:40
Sorry guys, my goof:
Date User Action Args
2022-04-11 14:56:45adminsetgithub: 49513
2009-02-14 22:21:26benjamin.petersonsetstatus: open -> closed
resolution: not a bug
2009-02-14 21:40:12gracesetmessages: + msg82121
2009-02-14 21:33:34gracecreate