Re: Unicode Variation Selector and Combining character

From: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
To: 荒井元成 <n2029(at)ndensan(dot)co(dot)jp>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Unicode Variation Selector and Combining character
Date: 2022-06-01 10:25:49
Message-ID: 0c1d767e-8e35-b0d4-c21b-16bc013123b2@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 01.06.22 08:15, 荒井元成 wrote:
> D209007=# select char_length(U&'\+0066FE' || U&'\+0E0103') ;
>
> char_length
>
> -------------
>
>            2
>
> (1 行)
>
> I expect length 1.

The char_length function is defined to return the length in characters,
so 2 is the correct answer. What you appear to be looking for is length
in glyphs or length in graphemes or display width, or something like
that. There is no built-in server side function for that.

It looks like psql is getting the display width wrong, but that's a
separate issue.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message 荒井元成 2022-06-01 10:35:36 RE: Unicode Variation Selector and Combining character
Previous Message Daniel Verite 2022-06-01 09:45:47 Re: Unicode Variation Selector and Combining character