Lists: | pgsql-hackerspgsql-ru-generalpgsql-zh-general |
---|
From: | "ciifrancesco(at)tiscali(dot)it" <ciifrancesco(at)tiscali(dot)it> |
---|---|
To: | <hannu(at)2ndQuadrant(dot)com> |
Cc: | <pgsql-hackers(at)postgresql(dot)org>, <pgsql-zh-general(at)postgresql(dot)org>, <pgsql-ru-general(at)postgresql(dot)org> |
Subject: | R: Re: [HACKERS] Chinese in Postgres |
Date: | 2013-08-16 12:40:09 |
Message-ID: | 22641734.19061376656809198.JavaMail.defaultUser@defaultHost |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers Postg토토 캔SQL : Postg토토 pgsql-zh-general |
Thanks for your answer.
Yes, the client is also UTF8:
MyDB=# show
client_encoding;
client_encoding
-----------------
UTF8
(1 row)
Cheers
Francesco
----Messaggio originale----
Da: hannu(at)2ndQuadrant(dot)com
Data: 16/08/2013 14.16
A: "ciifrancesco(at)tiscali(dot)it"
<ciifrancesco(at)tiscali(dot)it>
Cc: <pgsql-hackers(at)postgresql(dot)org>, <pgsql-zh-
general(at)postgresql(dot)org>, <pgsql-ru-general(at)postgresql(dot)org>
Ogg: Re:
[HACKERS] Chinese in Postgres
On 08/16/2013 01:25 PM,
ciifrancesco(at)tiscali(dot)it wrote:
> Hello all,
> before writing this
message, I wrote about this in other mailing lists
> without solving my
problem.
> Maybe some of you can help me.
>
> I have problems with a DB
in postgres, when i try to insert Chinese
> strings in utf-8 format.
>
If I insert the data using a C++ program I have empty squares, in this
> format: ��� (3 empty squares for each chinese ideogram as that is the
> length in utf-8)
> If the string contains chinese mixed with ASCII,
the ASCII is OK but
> the Chinese is broken:
> 漢語1-3漢語 --> ������1-
3������
Can you cehck that your client encoding is also UTF8
hannu=#
show client_encoding ;
client_encoding
-----------------
UTF8
(1 row)
Cheers
--
Hannu Krosing
PostgreSQL Consultant
Performance,
Scalability and High Availability
2ndQuadrant Nordic OÜ
--
Sent via
pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
To make
changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-
hackers
Invita i tuoi amici e Tiscali ti premia! Il consiglio di un amico vale più di uno spot in TV. Per ogni nuovo abbonato 30 € di premio per te e per lui! Un amico al mese e parli e navighi sempre gratis: http://freelosophy.tiscali.it/
From: | Hannu Krosing <hannu(at)2ndQuadrant(dot)com> |
---|---|
To: | "ciifrancesco(at)tiscali(dot)it" <ciifrancesco(at)tiscali(dot)it> |
Cc: | pgsql-hackers(at)postgresql(dot)org, pgsql-zh-general(at)postgresql(dot)org, pgsql-ru-general(at)postgresql(dot)org |
Subject: | Re: R: Re: [HACKERS] Chinese in Postgres |
Date: | 2013-08-16 12:45:13 |
Message-ID: | 520E1ED9.7080703@2ndQuadrant.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers pgsql-ru-general pgsql-zh-general |
On 08/16/2013 02:40 PM, ciifrancesco(at)tiscali(dot)it wrote:
> Thanks for your answer.
> Yes, the client is also UTF8:
>
> MyDB=# show
> client_encoding;
> client_encoding
> -----------------
> UTF8
> (1 row)
Strange, it works for me :
hannu(at)hannu-900X3E:~/workspace/my-app$ psql
psql (9.3beta2, server 9.2.4)
Type "help" for help.
hannu=# select * from pg_stat_activity;
hannu=# show client_encoding ;
client_encoding
-----------------
UTF8
(1 row)
hannu=# create table tchinese(data text);
CREATE TABLE
hannu=# insert into tchinese values('漢語1-3漢語');
INSERT 0 1
hannu=# select * from tchinese ;
data
-------------
漢語1-3漢語
(1 row)
hannu=# \q
Are you sure that the client-encoding is also the same when you are
actually doing the import ?
Or when you are getting the wrong results when reading
what does length() of the bad field give you ?
hannu=# select data, length(data) from tchinese ;
data | length
-------------+--------
漢語1-3漢語 | 7
(1 row)
--
Hannu Krosing
PostgreSQL Consultant
Performance, Scalability and High Availability
2ndQuadrant Nordic OÜ
From: | Song <mark3536(at)yahoo(dot)cn> |
---|---|
To: | "ciifrancesco(at)tiscali(dot)it" <ciifrancesco(at)tiscali(dot)it>, "hannu(at)2ndQuadrant(dot)com" <hannu(at)2ndQuadrant(dot)com> |
Cc: | "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, "pgsql-zh-general(at)postgresql(dot)org" <pgsql-zh-general(at)postgresql(dot)org>, "pgsql-ru-general(at)postgresql(dot)org" <pgsql-ru-general(at)postgresql(dot)org> |
Subject: | 回复: [pgsql-zh-general] R: Re: [HACKERS] Chinese in Postgres |
Date: | 2013-08-16 12:52:59 |
Message-ID: | 1376657579.64483.YahooMailNeo@web92413.mail.cnh.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers pgsql-ru-general pgsql-zh-general |
maybe your C++ program has something (such as charset or configuation) causing this strange thing
mark
________________________________
发件人: "ciifrancesco(at)tiscali(dot)it" <ciifrancesco(at)tiscali(dot)it>
收件人: hannu(at)2ndQuadrant(dot)com
抄送: pgsql-hackers(at)postgresql(dot)org; pgsql-zh-general(at)postgresql(dot)org; pgsql-ru-general(at)postgresql(dot)org
发送日期: 2013年8月16日, 星期五, 8:40 下午
主题: [pgsql-zh-general] R: Re: [HACKERS] Chinese in Postgres
Thanks for your answer.
Yes, the client is also UTF8:
MyDB=# show
client_encoding;
client_encoding
-----------------
UTF8
(1 row)
Cheers
Francesco
----Messaggio originale----
Da: hannu(at)2ndQuadrant(dot)com
Data: 16/08/2013 14.16
A: "ciifrancesco(at)tiscali(dot)it"
<ciifrancesco(at)tiscali(dot)it>
Cc: <pgsql-hackers(at)postgresql(dot)org>, <pgsql-zh-
general(at)postgresql(dot)org>, <pgsql-ru-general(at)postgresql(dot)org>
Ogg: Re:
[HACKERS] Chinese in Postgres
On 08/16/2013 01:25 PM,
ciifrancesco(at)tiscali(dot)it wrote:
> Hello all,
> before writing this
message, I wrote about this in other mailing lists
> without solving my
problem.
> Maybe some of you can help me.
>
> I have problems with a DB
in postgres, when i try to insert Chinese
> strings in utf-8 format.
>
If I insert the data using a C++ program I have empty squares, in this
> format: ��� (3 empty squares for each chinese ideogram as that is the
> length in utf-8)
> If the string contains chinese mixed with ASCII,
the ASCII is OK but
> the Chinese is broken:
> 漢語1-3漢語 --> ������1-
3������
Can you cehck that your client encoding is also UTF8
hannu=#
show client_encoding ;
client_encoding
-----------------
UTF8
(1 row)
Cheers
--
Hannu Krosing
PostgreSQL Consultant
Performance,
Scalability and High Availability
2ndQuadrant Nordic OÜ
--
Sent via
pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
To make
changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-
hackers
Invita i tuoi amici e Tiscali ti premia! Il consiglio di un amico vale più di uno spot in TV. Per ogni nuovo abbonato 30 € di premio per te e per lui! Un amico al mese e parli e navighi sempre gratis: http://freelosophy.tiscali.it/
From: | Rural Hunter <ruralhunter(at)gmail(dot)com> |
---|---|
To: | pgsql-zh-general(at)postgresql(dot)org |
Subject: | Re: R: Re: [HACKERS] Chinese in Postgres |
Date: | 2013-08-17 06:16:29 |
Message-ID: | 520F153D.9020302@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers pgsql-ru-general pgsql-zh-general |
Does your client have the Chinese fonts to display Chinese characters?
It looks more like font problem.
于 2013/8/16 20:40, ciifrancesco(at)tiscali(dot)it 写道:
> Thanks for your answer.
> Yes, the client is also UTF8:
>
> MyDB=# show
> client_encoding;
> client_encoding
> -----------------
> UTF8
> (1 row)
>
>
> Cheers
> Francesco
> ----Messaggio originale----
> Da: hannu(at)2ndQuadrant(dot)com
>
> Data: 16/08/2013 14.16
> A: "ciifrancesco(at)tiscali(dot)it"
> <ciifrancesco(at)tiscali(dot)it>
> Cc: <pgsql-hackers(at)postgresql(dot)org>, <pgsql-zh-
> general(at)postgresql(dot)org>, <pgsql-ru-general(at)postgresql(dot)org>
> Ogg: Re:
> [HACKERS] Chinese in Postgres
>
> On 08/16/2013 01:25 PM,
> ciifrancesco(at)tiscali(dot)it wrote:
>> Hello all,
>> before writing this
> message, I wrote about this in other mailing lists
>> without solving my
> problem.
>> Maybe some of you can help me.
>>
>> I have problems with a DB
> in postgres, when i try to insert Chinese
>> strings in utf-8 format.
>>
> If I insert the data using a C++ program I have empty squares, in this
>
>> format: ��� (3 empty squares for each chinese ideogram as that is the
>> length in utf-8)
>> If the string contains chinese mixed with ASCII,
> the ASCII is OK but
>> the Chinese is broken:
>> 漢語1-3漢語 --> ������1-
> 3������
> Can you cehck that your client encoding is also UTF8
>
> hannu=#
> show client_encoding ;
> client_encoding
> -----------------
> UTF8
> (1 row)
>
>
>
> Cheers
>
>
From: | Nicolas Barbier <nicolas(dot)barbier(at)gmail(dot)com> |
---|---|
To: | "ciifrancesco(at)tiscali(dot)it" <ciifrancesco(at)tiscali(dot)it> |
Cc: | hannu(at)2ndquadrant(dot)com, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, pgsql-zh-general(at)postgresql(dot)org, pgsql-ru-general(at)postgresql(dot)org |
Subject: | Re: Chinese in Postgres |
Date: | 2013-08-18 08:22:00 |
Message-ID: | CAP-rdTZ4cxgPzHLKakBvvTBxaWMOBFRuY4xDf6r-Ef5oL2a1uQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Lists: | pgsql-hackers pgsql-ru-general pgsql-zh-general |
[ Could you please trim your citations, i.e., please don’t top-post:
https://en.wikipedia.org/wiki/Posting_style#Top-posting ]
2013/8/16 Francesco <ciifrancesco(at)tiscali(dot)it>:
> Thanks for your answer.
> Yes, the client is also UTF8:
>
> MyDB=# show
> client_encoding;
> client_encoding
> -----------------
> UTF8
> (1 row)
I guess that this is the client encoding used by psql. I suspect your
C++-program doesn’t use client encoding UTF8. What library are you
using, libpq? Did you run the psql instance (whose output you pasted)
on Windows or on some kind of UNIX-machine over SSH? Does your
problematic C++-program run on Windows or the UNIX-machine?
(The “client encoding” is not a property of the database, but of the
specific client you are using. The C++-program’s client encoding might
therefore by entirely different from the one used by psql, especially
if you don’t run them on the same machine.)
[ BTW, I think this question really doesn’t belong on -hackers, as
no-one seems to think it is a bug, nor is it a question about
PostgreSQL internals. ]
Nicolas
--
A. Because it breaks the logical sequence of discussion.
Q. Why is top posting bad?