Search Postgresql Archives

Re: How to display complicated Chinese character: Biang.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2022-06-02 at 12:45 +0530, jian he wrote:
> Trying to display some special Chinese characters in Postgresql.
> 
> localhost:5433 admin@test=# show LC_COLLATE;
> +------------+
> | lc_collate |
> +------------+
> | C.UTF-8    |
> +------------+ 
> 
> > with strings(s) as (
> >  values (U&'\+0030EDD')
> > )
> > select s,
> >   octet_length(s),
> >   char_length(s),
> >   (select count(*) from icu_character_boundaries(s,'en')) as graphemes from strings;
> > 
> 
> +-----+--------------+-------------+-----------+
> |  s    | octet_length | char_length | graphemes |
> +-----+--------------+-------------+-----------+
> | ロD |            4      |           2          |         2 |
> +-----+--------------+-------------+-----------+
> 
> Seems not right. graphemes should be 1?

You have an extra "0" there; "\+" unicode escapes have exactly 6 digits:

WITH strings(s) AS (
   VALUES (U&'\+030EDD')
)
select s,
       octet_length(s),
       char_length(s) 
from strings;

 s  │ octet_length │ char_length 
════╪══════════════╪═════════════
 𰻝 │            4 │           1
(1 row)

PostgreSQL doesn't have a function "icu_character_boundaries".

Yours,
Laurenz Albe
-- 
Cybertec | https://www.cybertec-postgresql.com





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux