Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error printing UTF-8 decoded text #49513

Closed
grace mannequin opened this issue Feb 14, 2009 · 2 comments
Closed

Error printing UTF-8 decoded text #49513

grace mannequin opened this issue Feb 14, 2009 · 2 comments
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-crash A hard crash of the interpreter, possibly with a core dump

Comments

@grace
Copy link
Mannequin

grace mannequin commented Feb 14, 2009

BPO 5263

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2009-02-14.22:21:26.788>
created_at = <Date 2009-02-14.21:33:34.361>
labels = ['interpreter-core', 'invalid', 'type-crash']
title = 'Error printing UTF-8 decoded text'
updated_at = <Date 2009-02-14.22:21:26.787>
user = 'https://bugs.python.org/grace'

bugs.python.org fields:

activity = <Date 2009-02-14.22:21:26.787>
actor = 'benjamin.peterson'
assignee = 'none'
closed = True
closed_date = <Date 2009-02-14.22:21:26.788>
closer = 'benjamin.peterson'
components = ['Interpreter Core']
creation = <Date 2009-02-14.21:33:34.361>
creator = 'grace'
dependencies = []
files = []
hgrepos = []
issue_num = 5263
keywords = []
message_count = 2.0
messages = ['82120', '82121']
nosy_count = 1.0
nosy_names = ['grace']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = None
status = 'closed'
superseder = None
type = 'crash'
url = 'https://bugs.python.org/issue5263'
versions = ['Python 3.1']

@grace
Copy link
Mannequin Author

grace mannequin commented Feb 14, 2009

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>

@grace grace mannequin added interpreter-core (Objects, Python, Grammar, and Parser dirs) type-crash A hard crash of the interpreter, possibly with a core dump labels Feb 14, 2009
@grace
Copy link
Mannequin Author

grace mannequin commented Feb 14, 2009

Sorry guys, my goof:

http://wiki.python.org/moin/PrintFails

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-crash A hard crash of the interpreter, possibly with a core dump
Projects
None yet
Development

No branches or pull requests

1 participant