Re: Decision by Monday: PQescapeString() vs. encoding violation - Mailing list pgsql-hackers

From Jeff Davis
Subject Re: Decision by Monday: PQescapeString() vs. encoding violation
Date
Msg-id 186954494c6b0bf643b1aa42fc67e9e25386ebe0.camel@j-davis.com
Whole thread Raw
Responses Re: Decision by Monday: PQescapeString() vs. encoding violation
List pgsql-hackers
On Fri, 2025-02-14 at 17:27 -0800, Noah Misch wrote:
> I'm attaching a WIP patch from Andres Freund.

I am not suggesting a change, but there's a minor point about the
behavior of the replacement that I'd like to highlight:

Unicode discusses a choice[1]: "An ill-formed subsequence consisting of
more than one code unit could be treated as a single error or as
multiple errors."

The patch implements the latter. Escaping:
   <7A F0 80 80 41 7A>
results in:
   <7A C0 20 C0 20 C0 20 41 7A>

The Unicode standard suggests[2] that the former approach may provide
more consistency in how it's done, but that doesn't seem important or
relevant for our purposes. I'd favor whichever approach results in
simpler code.

Regards,
    Jeff Davis

[1]
https://www.unicode.org/versions/Unicode16.0.0/core-spec/chapter-3/#G48534

[2]
https://www.unicode.org/versions/Unicode16.0.0/core-spec/chapter-3/#G66453



pgsql-hackers by date:

Previous
From: Jeff Davis
Date:
Subject: Re: Decision by Monday: PQescapeString() vs. encoding violation
Next
From: Andres Freund
Date:
Subject: Re: Decision by Monday: PQescapeString() vs. encoding violation