Re: invalidly encoded strings - Mailing list pgsql-hackers

From Tom Lane
Subject Re: invalidly encoded strings
Date
Msg-id 3702.1189433070@sss.pgh.pa.us
Whole thread Raw
In response to Re: invalidly encoded strings  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: invalidly encoded strings
List pgsql-hackers
Andrew Dunstan <andrew@dunslane.net> writes:
> The reason we are prepared to make an exception for Unicode is precisely 
> because the code point maps to an encoding pattern independently of 
> architecture, ISTM.

Right --- there is a well-defined standard for the numerical value of
each character in Unicode.  And it's also clear what to do in
single-byte encodings.  It's not at all clear what the representation
ought to be for other multibyte encodings.  A direct transliteration
of the byte sequence not only has endianness issues, but will have
a weird non-dense set of valid values because of the restrictions on
valid multibyte characters.

Given that chr() has never before behaved sanely for multibyte values at
all, extending it to Unicode code points is a reasonable extension,
and throwing error for other encodings is reasonable too.  If we ever do
come across code-point standards for other encodings we can adopt 'em at
that time.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Oleg Bartunov
Date:
Subject: Re: Include Lists for Text Search
Next
From: Tom Lane
Date:
Subject: Re: invalidly encoded strings