pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
can  postgresql  supported   utf8mb4    character sets ?
5+ messages / 3 participants
[nested] [flat]

* can  postgresql  supported   utf8mb4    character sets ?
@ 2015-03-05 09:45  lsliang <lsliang@pconline.com.cn>
  0 siblings, 2 replies; 5+ messages in thread

From: lsliang @ 2015-03-05 09:45 UTC (permalink / raw)
  To: pgsql-general



can  postgresql   supported   utf8mb4  character set? 




today   mobile  apps  support   4-byte  character   and  utf8 can only support  1-3 bytes character  


if   load  string  to database    which  contain  a  4-byte character   will  failed  .

mysql   since  5.5.3 support  utf8mb4 character sets  

I don't  find  some information  about  postgresql 

 thanks  

^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: can  postgresql  supported   utf8mb4    character sets ?
@ 2015-03-05 13:25  Adrian Klaver <adrian.klaver@aklaver.com>
  parent: lsliang <lsliang@pconline.com.cn>
  1 sibling, 0 replies; 5+ messages in thread

From: Adrian Klaver @ 2015-03-05 13:25 UTC (permalink / raw)
  To: lsliang <lsliang@pconline.com.cn>; pgsql-general

On 03/05/2015 01:45 AM, lsliang wrote:
> can  postgresql supported   utf8mb4  character set?
> today   mobile  apps support   4-byte  character   and  utf8 can only
> support  1-3 bytes character

The docs would seem to indicate otherwise:

http://www.postgresql.org/docs/9.3/interactive/multibyte.html

http://en.wikipedia.org/wiki/UTF-8


> if   load  string  to database which  contain  a  4-byte character
> will failed  .

Have you actually tried to load strings in to Postgres?

If so and it failed what was the method you used and what was the error?

> mysql   since  5.5.3 support utf8mb4 character sets
> I don't  find  some information about  postgresql
>   thanks


-- 
Adrian Klaver
adrian.klaver@aklaver.com


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

*  Re: Re: [GENERAL] can  postgresql  supported   utf8mb4    character sets?
@ 2015-03-06 02:55  lsliang <lsliang@pconline.com.cn>
  parent: lsliang <lsliang@pconline.com.cn>
  1 sibling, 2 replies; 5+ messages in thread

From: lsliang @ 2015-03-06 02:55 UTC (permalink / raw)
  To: Adrian Klaver <adrian.klaver@aklaver.com>; pgsql-general





2015-03-06




发件人:Adrian Klaver
发送时间:2015-03-05 21:31:39
收件人:lsliang; pgsql-general
抄送:
主题:Re: [GENERAL] can postgresql supported utf8mb4 character sets?

On 03/05/2015 01:45 AM, lsliang wrote:
> can  postgresql supported   utf8mb4  character set?
> today   mobile  apps support   4-byte  character   and  utf8 can only
> support  1-3 bytes character
The docs would seem to indicate otherwise:
http://www.postgresql.org/docs/9.3/interactive/multibyte.html
http://en.wikipedia.org/wiki/UTF-8
> if   load  string  to database which  contain  a  4-byte character
> will failed  .
Have you actually tried to load strings in to Postgres?
If so and it failed what was the method you used and what was the error?
> mysql   since  5.5.3 support utf8mb4 character sets
> I don't  find  some information about  postgresql
>   thanks
-- 
Adrian Klaver
adrian.klaver@aklaver.com

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
thanks   for  your help . 

 postgresql   can support   4-byte  character   

test=> select * from utf8mb4_test ;
ERROR:  character with byte sequence 0xf0 0x9f 0x98 0x84 in encoding "UTF8" has no equivalent in encoding "GB18030"
test=> \encoding utf8 
test=> select * from utf8mb4_test ;
 content 
---------
 😄
 😄

pcauto=> 


^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: can  postgresql  supported   utf8mb4    character sets?
@ 2015-03-06 14:55  Adrian Klaver <adrian.klaver@aklaver.com>
  parent: lsliang <lsliang@pconline.com.cn>
  1 sibling, 0 replies; 5+ messages in thread

From: Adrian Klaver @ 2015-03-06 14:55 UTC (permalink / raw)
  To: lsliang <lsliang@pconline.com.cn>; pgsql-general

On 03/05/2015 06:55 PM, lsliang wrote:
> 2015-03-06
> *
> *
> ------------------------------------------------------------------------
> *发件人:*Adrian Klaver
> *发送时间:*2015-03-05 21:31:39
> *收件人:*lsliang; pgsql-general
> *抄送:*
> *主题:*Re: [GENERAL] can postgresql supported utf8mb4 character sets?
> On 03/05/2015 01:45 AM, lsliang wrote:
>  > can  postgresql supported   utf8mb4  character set?
>  > today   mobile  apps support   4-byte  character   and  utf8 can only
>  > support  1-3 bytes character
> The docs would seem to indicate otherwise:
> http://www.postgresql.org/docs/9.3/interactive/multibyte.html
> http://en.wikipedia.org/wiki/UTF-8
>  > if   load  string  to database which  contain  a  4-byte character
>  > will failed  .
> Have you actually tried to load strings in to Postgres?
> If so and it failed what was the method you used and what was the error?
>  > mysql   since  5.5.3 support utf8mb4 character sets
>  > I don't  find  some information about  postgresql
>  >   thanks
> --
> Adrian Klaver
> adrian.klaver@aklaver.com <mailto:adrian.klaver@aklaver.com>
>  >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> thanks   for  your help .
>   postgresql   can support   4-byte character
> test=> select * from utf8mb4_test ;
> ERROR:  character with byte sequence 0xf0 0x9f 0x98 0x84 in encoding "UTF8" has no equivalent in encoding "GB18030"
> test=> \encoding utf8
> test=> select * from utf8mb4_test ;
>   content
> ---------
>   😄
>   😄
> pcauto=>


FYI, you can force the client encoding:

http://www.postgresql.org/docs/9.4/interactive/app-psql.html

"If both standard input and standard output are a terminal, then psql 
sets the client encoding to "auto", which will detect the appropriate 
client encoding from the locale settings (LC_CTYPE environment variable 
on Unix systems). If this doesn't work out as expected, the client 
encoding can be overridden using the environment variable PGCLIENTENCODING."



-- 
Adrian Klaver
adrian.klaver@aklaver.com


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* Re: Re: Re: [GENERAL] can postgresql supported utf8mb4 character sets?
@ 2015-03-07 08:18  Arjen Nienhuis <a.g.nienhuis@gmail.com>
  parent: lsliang <lsliang@pconline.com.cn>
  1 sibling, 0 replies; 5+ messages in thread

From: Arjen Nienhuis @ 2015-03-07 08:18 UTC (permalink / raw)
  To: lsliang <lsliang@pconline.com.cn>; +Cc: Adrian Klaver <adrian.klaver@aklaver.com>; pgsql-general

On Fri, Mar 6, 2015 at 3:55 AM, lsliang <lsliang@pconline.com.cn> wrote:

>
>
>
>
> 2015-03-06
>
> ------------------------------
>  *发件人:*Adrian Klaver
> *发送时间:*2015-03-05 21:31:39
> *收件人:*lsliang; pgsql-general
> *抄送:*
> *主题:*Re: [GENERAL] can postgresql supported utf8mb4 character sets?
>
>  On 03/05/2015 01:45 AM, lsliang wrote:
> > can  postgresql supported   utf8mb4  character set?
> > today   mobile  apps support   4-byte  character   and  utf8 can only
> > support  1-3 bytes character
>  The docs would seem to indicate otherwise:
>  http://www.postgresql.org/docs/9.3/interactive/multibyte.html
>  http://en.wikipedia.org/wiki/UTF-8
>  > if   load  string  to database which  contain  a  4-byte character
> > will failed  .
>  Have you actually tried to load strings in to Postgres?
>  If so and it failed what was the method you used and what was the error?
>  > mysql   since  5.5.3 support utf8mb4 character sets
> > I don't  find  some information about  postgresql
> >   thanks
>  --
> Adrian Klaver
> adrian.klaver@aklaver.com
>
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>  thanks   for  your help .
>
>  postgresql   can support   4-byte  character
>
>  test=> select * from utf8mb4_test ;
>
> ERROR:  character with byte sequence 0xf0 0x9f 0x98 0x84 in encoding "UTF8" has no equivalent in encoding "GB18030"
> test=> \encoding utf8
> test=> select * from utf8mb4_test ;
>  content
> ---------
>  😄
>  😄
>
>  pcauto=>
>
>
>

UTF-8 support works fine. The 3 byte limit was something mysql invented.
But it only works if your client encoding is UTF-8. In your example, your
terminal is not set to UTF-8.

create table test (glyph text);
insert into test values ('A'), ('馬'), ('𐁀'), ('😄'), ('🇪🇸');

select glyph, convert_to(glyph, 'utf-8'), length(glyph) FROM test;
 glyph |     convert_to     | length
-------+--------------------+--------
 A     | \x41               |      1
 馬    | \xe9a6ac           |      1
 𐁀     | \xf0908180         |      1
 😄     | \xf09f9884         |      1
 🇪🇸    | \xf09f87aaf09f87b8 |      2
(5 rows)

What doesn't work is GB18030:

select glyph, convert_to(glyph, 'GB18030'), length(glyph) FROM test;
ERROR:  character with byte sequence 0xf0 0x90 0x81 0x80 in encoding "UTF8"
has no equivalent in encoding "GB18030"

I think that is a bug.

Gr. Arjen

^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2015-03-07 08:18 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2015-03-05 09:45 can  postgresql  supported   utf8mb4    character sets ? lsliang <lsliang@pconline.com.cn>
2015-03-05 13:25 ` Adrian Klaver <adrian.klaver@aklaver.com>
2015-03-06 02:55 `  Re: Re: [GENERAL] can  postgresql  supported   utf8mb4    character sets? lsliang <lsliang@pconline.com.cn>
2015-03-06 14:55   ` Re: can  postgresql  supported   utf8mb4    character sets? Adrian Klaver <adrian.klaver@aklaver.com>
2015-03-07 08:18   ` Re: Re: Re: [GENERAL] can postgresql supported utf8mb4 character sets? Arjen Nienhuis <a.g.nienhuis@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox