[Python-3000] XML as bytes or unicode?

Brett Cannon brett at python.org
Mon Aug 18 19:29:25 CEST 2008


On Mon, Aug 18, 2008 at 9:54 AM, Antoine Pitrou <solipsis at pitrou.net> wrote:
> Benjamin Peterson <musiccomposition <at> gmail.com> writes:
>>
>> Well, unless the parser decodes explicitly, I believe this should be true.
>
> XML documents have an encoding declaration... the parser's should be able to
> handle it, no?
>

Well, does the parser handle it or should the code that got the XML in
the first place handle it? Depends on who should take responsibility.
Apparently whomever wrote the parsers originally thought it was not
the parser's job. =)

If someone wanted to you could possibly dispatch on bytes to some code
that tried to determine the encoding and do the proper decode before
proceeding.

-Brett


More information about the Python-3000 mailing list