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.

Author grace
Recipients grace
Date 2009-02-14.21:33:33
SpamBayes Score 8.402447e-07
Marked as misclassified No
Message-id <1234647215.76.0.528170813842.issue5263@psf.upfronthosting.co.za>
In-reply-to
Content
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 =
urllib.request.urlopen("http://docs.python.org/3.0/library/html.parser.html#html.parser.HTMLParser.handle_startendtag")
    htmlSource = sock.read()
    sock.close()

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



Error message:
Traceback (most recent call last):
  File "parsehomeless.py", line 68, in <module>
    print(htmlSource[0:281])
  File "C:\Python30\lib\io.py", line 1494, in write
    b = encoder.encode(s)
  File "C:\Python30\lib\encodings\cp862.py", 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>
History
Date User Action Args
2009-02-14 21:33:35gracesetrecipients: + grace
2009-02-14 21:33:35gracesetmessageid: <1234647215.76.0.528170813842.issue5263@psf.upfronthosting.co.za>
2009-02-14 21:33:34gracelinkissue5263 messages
2009-02-14 21:33:33gracecreate