Re: invalidly encoded strings - Mailing list pgsql-hackers

From Tatsuo Ishii
Subject Re: invalidly encoded strings
Date
Msg-id 20070912.124356.41631070.t-ishii@sraoss.co.jp
Whole thread Raw
In response to Re: invalidly encoded strings  (Alvaro Herrera <alvherre@commandprompt.com>)
List pgsql-hackers
> However ISTM we would also need something like
> 
> length(bytea, name) returns int
>     -- counts the number of characters assuming that the bytea is in
>     -- the given encoding
> 
> Hmm, I wonder if counting chars is consistent regardless of the
> encoding the string is in.  To me it sounds like it should, in which
> case it works to convert to the DB encoding and count chars there.

Not necessarily.

It's possible that after encoding conversion, number of chars are
different before and after. An example is, UTF-8 and EUC_JIS_2004.

0xa4f7(EUC_JIS_2004) <--> U+304B *and* U+309A (Unicode)

This is defined in the Japanese goverment's standard.
--
Tatsuo Ishii
SRA OSS, Inc. Japan


pgsql-hackers by date:

Previous
From: "Brendan Jurd"
Date:
Subject: Re: Per-function search_path => per-function GUC settings
Next
From: Tom Lane
Date:
Subject: Re: CVS HEAD is broken by flex