Re: xml_parser_create patch
| From: | Adam Dickmeiss | Date: | Wed, 07 May 2003 13:21:35 +0000 |
| Subject: | Re: xml_parser_create patch | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-1349@lists.php.net to get a copy of this message | ||
On Wed, May 07, 2003 at 03:02:17PM +0200, Marcus Börger wrote:
> At 12:55 07.05.2003, Adam Dickmeiss wrote:
> >On Wed, May 07, 2003 at 11:59:24AM +0200, Marcus Börger wrote:
> >> At 11:43 07.05.2003, Adam Dickmeiss wrote:
> >> >[...]
> >> >Note that this patch _may_ break applications that assumes
> >> >ISO-8859-1 (or default encoding) for XML applications, but only
> >> >if the application omitted a desired encoding for xml_parser_create.
> >> >
> >>
> >> Then why not make it the default value ?
> >Then tell me . What would that default value be?
> >
> >What I want a way to let the XML document tell my
> >Expat XML parser what encoding it's using..
>
>
> Iirc then before the change every one supposes that ISO-8859-1
> will be handled. So that should be the default. In other words we
> should do BC.
BC. Fine. I don't think you understand what I'm trying to
achieve with this fix.
Suppose I have an XML document that looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<something/>
and I call xml_parser_create() without arguments, then
Expat (without my fix) will assume that the document
uses default encoding which currently is ISO-8859-1. So really,
there is nothing default about it. Since it ignores the
encoding in the XML document, it should probably be called
force_encoding (or similar:)
The only place where specifying an encoding makes sense is
if you parse XML files with no encoding attribute at all in them.
And frankly, even assuming ISO-8859-1 there, is bad. UTF-8 should be
default. But that's another issue.
Note that the issue is totally separate from target encoding
which is the desired encoding within PHP strings..
Now, there are probably apps out there uses this bad
behaviour, so BC is desirable. That's why I suggest
that using
xml_parser_create("");
does the _right_thing_. And other options are BC.
I am, of course, willing to send a patch for that.
-- Adam
> marcus
--
Adam Dickmeiss mailto:adam@indexdata.dk http://www.indexdata.dk
Index Data T: +45 33410100 Mob.: 212 212 66