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.

classification
Title: xml.sax.saxutils.XMLGenerator doesn't support byte strings
Type: behavior Stage: resolved
Components: Library (Lib), XML Versions: Python 3.3, Python 3.4, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: Arfrever, BreamoreBoy, benjamin.peterson, doerwalter, georg.brandl, larry, loewis, neoecos, neoecos, ngrig, pitrou, python-dev, serhiy.storchaka, skarcha
Priority: normal Keywords: patch

Created on 2013-03-31 22:03 by neoecos, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
XMLGenerator.patch neoecos, 2013-03-31 22:03 Patch for saxutils.py
XMLGenerator.patch neoecos, 2013-04-02 18:32 The patch incluiding saxutils.py and test_sax.py review
Messages (6)
msg185684 - (view) Author: Sebastian Ortiz Vasquez (neoecos) Date: 2013-03-31 22:03
The XMLGenerator character method is unable to detect and encode using the encoding defined in the constructor.

This yields to an UnicodeEncode exception, because always tries to encode using 'ascii' as default in python 2
msg185686 - (view) Author: Arfrever Frehtes Taifersar Arahesis (Arfrever) * (Python triager) Date: 2013-03-31 22:13
Your patch does not apply cleanly to 2.7 branch.
Please read documentation:
http://docs.python.org/devguide/
http://docs.python.org/devguide/setup.html#checkout
Use e.g. 'hg diff' to create patch.

Only security fixes are allowed in 2.6 branch.
msg185687 - (view) Author: Arfrever Frehtes Taifersar Arahesis (Arfrever) * (Python triager) Date: 2013-03-31 22:15
Also please try to write a new test.
msg185854 - (view) Author: Sebastian Ortiz Vasquez (neoecos) Date: 2013-04-02 18:31
Added new test and patch generated following the python development directions found on http://docs.python.org/devguide/patch.html
msg189037 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-05-12 14:32
New changeset a32a3b79f5e8 by Serhiy Storchaka in branch '2.7':
Issue #17606: Fixed support of encoded byte strings in the XMLGenerator
http://hg.python.org/cpython/rev/a32a3b79f5e8

New changeset e730447caf20 by Serhiy Storchaka in branch '3.3':
Issue #17606: Fixed support of encoded byte strings in the XMLGenerator
http://hg.python.org/cpython/rev/e730447caf20

New changeset 00afa5350f6a by Serhiy Storchaka in branch 'default':
Issue #17606: Fixed support of encoded byte strings in the XMLGenerator
http://hg.python.org/cpython/rev/00afa5350f6a
msg189038 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-05-12 14:41
Thank you Sebastian for your report and patch.
History
Date User Action Args
2022-04-11 14:57:43adminsetgithub: 61806
2013-05-12 14:41:42serhiy.storchakasetstatus: open -> closed

type: crash -> behavior
assignee: serhiy.storchaka
components: + Library (Lib)
title: xml.sax.saxutils.XMLGenerator cannot output with the correct encoding -> xml.sax.saxutils.XMLGenerator doesn't support byte strings
messages: + msg189038
versions: + Python 3.3, Python 3.4
resolution: fixed
stage: resolved
2013-05-12 14:32:49python-devsetmessages: + msg189037
2013-05-12 07:59:34skarchasetnosy: + skarcha
2013-04-02 18:32:57neoecossetfiles: + XMLGenerator.patch
2013-04-02 18:32:33neoecossetfiles: - XMLGenerator.patch
2013-04-02 18:31:23neoecossetfiles: + XMLGenerator.patch
type: crash
messages: + msg185854
2013-03-31 22:15:39Arfreversetmessages: + msg185687
2013-03-31 22:13:17Arfreversettitle: BUG: XMLGenerator cannot output with the correct encoding -> xml.sax.saxutils.XMLGenerator cannot output with the correct encoding
messages: + msg185686
versions: - Python 2.6
2013-03-31 22:03:10neoecoscreate