← 输入框|github.com|刷新
Skip to content

xml.sax.saxutils.escape does not escapes \x00 #57857

Closed

Description

@animus
mannequin
BPO 13648
Nosy @loewis

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 2012-06-20.19:56:12.020>
created_at = <Date 2011-12-22.14:49:17.023>
labels = ['expert-XML', 'type-bug']
title = 'xml.sax.saxutils.escape does not escapes \\x00'
updated_at = <Date 2012-06-20.19:56:12.019>
user = 'https://bugs.python.org/animus'

bugs.python.org fields:

activity = <Date 2012-06-20.19:56:12.019>
actor = 'loewis'
assignee = 'none'
closed = True
closed_date = <Date 2012-06-20.19:56:12.020>
closer = 'loewis'
components = ['XML']
creation = <Date 2011-12-22.14:49:17.023>
creator = 'animus'
dependencies = []
files = []
hgrepos = []
issue_num = 13648
keywords = []
message_count = 6.0
messages = ['150096', '150097', '150136', '163291', '163292', '163294']
nosy_count = 2.0
nosy_names = ['loewis', 'animus']
pr_nums = []
priority = 'normal'
resolution = 'wont fix'
stage = None
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue13648'
versions = ['Python 2.6', 'Python 3.1', 'Python 2.7', 'Python 3.2']

Activity

  1. animus commented on Dec 22, 2011

    animusmannequin
    MannequinAuthor

    function xml.sax.saxutils.escape('\x00qweqwe<') returns '\x00qweqwe<'

    \x00 did not escaped to �

    is this is a correct behavior?

    this is influences tools like xmpppy, which sends \x00 not encoded and leads to xmpp error.

  2. animus commented on Dec 22, 2011

    animusmannequin
    MannequinAuthor

    sorry, xmpppy uses it's own escape method, but anyway... :)

  3. loewis commented on Dec 23, 2011

    loewismannequin
    Mannequin

    This is correct behavior. \x00 is not supported in XML: not in raw form, and not in escaped form. To transmit binary data in XML, use base64.

  4. animus commented on Jun 20, 2012

    animusmannequin
    MannequinAuthor

    This is correct behavior. \x00 is not supported in XML:
    not in raw form, and not in escaped form

    last sentence in forth paragraph of section 1.3 in XML 1.1 specification says following:
    ======
    Due to potential problems with APIs,
    #x0 is still forbidden both directly and as a character reference.
    ======

    And, second sentence in paragraph 2 in subsection 'Validity constraint: Notation Declared' of section 4.2.2 says following:
    ======
    The characters to be escaped are the control characters #x0 to #x1F and #x7F (most of which cannot appear in XML), space #x20, the delimiters '<' #x3C, '>' #x3E and '"' #x22, the unwise characters '{' #x7B, '}' #x7D, '|' #x7C, '\' #x5C, '^' #x5E and '`' #x60, as well as all characters above #x7F.
    ======

    (xml 1.1) http://www.w3.org/TR/2006/REC-xml11-20060816/
    (xml 1.0) http://www.w3.org/TR/2008/REC-xml-20081126/

  5. reopened this on Jun 20, 2012
  6. animus commented on Jun 20, 2012

    animusmannequin
    MannequinAuthor

    What am I trying to say is: if those characters are forbidden, then maybe they need to be escaped rather than ignored?

  7. loewis commented on Jun 20, 2012

    loewismannequin
    Mannequin

    The characters are forbidden both in raw form *and* in escaped form. So even if they get escaped, they *still* will lead to errors. So there is no point in escaping them.

  8. 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