Ignore XML declaration in xpath_internal(), for UTF8 databases.
Noah Misch <noah@leadboat.com>
Ignore XML declaration in xpath_internal(), for UTF8 databases. When a value contained an XML declaration naming some other encoding, this function interpreted UTF8 bytes as the named encoding, yielding mojibake. xml_parse() already has similar logic. This would be necessary but not sufficient for non-UTF8 databases, so preserve behavior there until the xpath facility can support such databases comprehensively. Back-patch to 9.3 (all supported versions). Pavel Stehule and Noah Misch Discussion: https://postgr.es/m/CAFj8pRC-dM=tT=QkGi+Achkm+gwPmjyOayGuUfXVumCxkDgYWg@mail.gmail.com
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/utils/adt/xml.c | modified | +13 −1 |
| src/test/regress/expected/xml_1.out | modified | +35 −0 |
| src/test/regress/expected/xml_2.out | modified | +31 −0 |
| src/test/regress/expected/xml.out | modified | +31 −0 |
| src/test/regress/sql/xml.sql | modified | +32 −0 |
Discussion
- possible encoding issues with libxml2 functions 27 messages · 2017-02-20 → 2017-11-12