Skip to content

Parsing XML file with Unicode characters causes problem #47992

Closed

Description

@jaylogan
mannequin
BPO 3742
Nosy @ezio-melotti
Files
  • read_song_xml.py: Python program to load an XML file argument
  • 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-21.03:15:31.813>
    created_at = <Date 2008-08-31.19:43:38.076>
    labels = ['expert-XML', 'type-bug', 'invalid']
    title = 'Parsing XML file with Unicode characters causes problem'
    updated_at = <Date 2009-02-21.03:15:31.812>
    user = 'https://bugs.python.org/jaylogan'

    bugs.python.org fields:

    activity = <Date 2009-02-21.03:15:31.812>
    actor = 'benjamin.peterson'
    assignee = 'none'
    closed = True
    closed_date = <Date 2009-02-21.03:15:31.813>
    closer = 'benjamin.peterson'
    components = ['XML']
    creation = <Date 2008-08-31.19:43:38.076>
    creator = 'jaylogan'
    dependencies = []
    files = ['11319']
    hgrepos = []
    issue_num = 3742
    keywords = []
    message_count = 2.0
    messages = ['72211', '82519']
    nosy_count = 2.0
    nosy_names = ['ezio.melotti', 'jaylogan']
    pr_nums = []
    priority = 'normal'
    resolution = 'not a bug'
    stage = None
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue3742'
    versions = ['Python 3.0']

    Activity

    1. jaylogan commented on Aug 31, 2008

      jayloganmannequin
      MannequinAuthor

      Python 3.0b2 will not parse the XML file located at
      http://rubyquiz.com/SongLibrary.xml.gz

      It complains of a UnicodeEncodeError
      'charmap' codec can't encode character '\xc8' in position 45: ch
      aracter maps to <undefined>

      I included a sample program, just in case I was doing something wrong
      while coding.

      Python 3.0b2 (r30b2:65106, Jul 18 2008, 18:44:17) [MSC v.1500 32 bit
      (Intel)] on win32
      Type "help", "copyright", "credits" or "license" for more information.

    2. ezio-melotti commented on Feb 20, 2009

      @ezio-melotti
      Member

      The encoding used by the windows terminal (usually cp850) is not able to
      encode all the characters, so when you print the text that you extract
      from the xml file the terminal is not able able to display some
      characters. If you remove the print() it works fine. You can also try to
      write the results on a file using utf-8.

      This issue can be closed.

    3. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      topic-XMLtype-bugAn unexpected behavior, bug, or error

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions