# xml_parser_create patch

- Thread: https://externals.io/message/1335
- Original archive: https://news-web.php.net/php.internals/1335
- Started by Adam Dickmeiss on 2003-05-07T09:43:03+00:00
- Messages: 4
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #1335 — Adam Dickmeiss — 2003-05-07T09:43:03+00:00

URL: https://externals.io/message/1335#1335

Hi,

I'd like to submit a small patch that allows xml_parser_create
and xml_parser_create_ns (Expat version) to honor the encoding of
an XML document (including UTF-16). This solves bug #23293. With this
patch xml_parser_create now works identical to the libxml2 version of it
(AFAIK).
 
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.
 
Applications that wish their XML parser to do decoding
but want a specific target encoding can use option
 `XML_OPTION_TARGET_ENCODING` .
 
-- Adam
 
-- 
Adam Dickmeiss  mailto:adam@indexdata.dk  http://www.indexdata.dk
Index Data      T: +45 33410100           Mob.: 212 212 66

---

## #1338 — marcus.boerger@t-online.de — 2003-05-07T09:59:24+00:00

URL: https://externals.io/message/1335#1338 · In reply to: #1335

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 ?

[...]


marcus

---

## #1352 — Moriyoshi Koizumi — 2003-05-07T13:54:04+00:00

URL: https://externals.io/message/1335#1352

Adam Dickmeiss <adam@indexdata.dk> wrote:

> 
> > […]
> I respect that. I hope Streling does too with a new layer on
> top ..
> 
> How about letting the empty string mean : Auto encoding??
> 
> xml_parser_create("");    //  any decoding! (pass 0 to Expat)
> 
> `xml_parser_create()`;       // use default for input&output
> 
> xml_parser_create("x");    // Use decoding x for input&output
> 

Looks like the best option to me.

Moriyoshi

---

## #1374 — Derick Rethans — 2003-05-08T11:36:32+00:00

URL: https://externals.io/message/1335#1374

> 
> > […]
> I respect that. I hope Streling does too with a new layer on
> top ..
> 
> How about letting the empty string mean : Auto encoding??
> 
> xml_parser_create("");    //  any decoding! (pass 0 to Expat)

too much magic.

Derick

-- 
                                        "my other box is your windows PC"
-------------------------------------------------------------------------
 Derick Rethans                                 http://derickrethans.nl/ 
 PHP Magazine - PHP Magazine for Professionals       http://php-mag.net/
