Re: possible encoding issues with libxml2 functions
Pavel Stehule <pavel.stehule@gmail.com>
From: Pavel Stehule <pavel.stehule@gmail.com>
To: Noah Misch <noah@leadboat.com>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2017-08-21T04:25:29Z
Lists: pgsql-hackers
>
> xpath-bugfix.patch affected only xml values containing an xml declaration
> with
> "encoding" attribute. In UTF8 databases, this latest proposal
> (xpath-parsing-error-fix.patch) is equivalent to xpath-bugfix.patch. In
> non-UTF8 databases, xpath-parsing-error-fix.patch affects all xml values
> containing non-ASCII data. In a LATIN1 database, the following works today
> but breaks under your latest proposal:
>
> SELECT xpath('text()', ('<x>' || convert_from('\xc2b0', 'LATIN1') ||
> '</x>')::xml);
>
> It's acceptable to break that, since the documentation explicitly disclaims
> support for it. xpath-bugfix.patch breaks different use cases, which are
> likewise acceptable to break. See my 2017-08-08 review for details.
>
The fact so this code is working shows so a universe is pretty dangerous
place :)
Commits
-
Ignore XML declaration in xpath_internal(), for UTF8 databases.
- d8406b9de910 9.3.21 landed
- 2f4061aff504 9.4.16 landed
- e7083dfce575 9.5.11 landed
- 46fb15f48a2d 9.6.7 landed
- 30a5e940ac9a 10.2 landed
- 2918fcedbf2b 11.0 landed
-
Add warning that xpath() doesn't work with non-UTF8 data.
- 14180f921493 8.4.0 cited