R: 回复: R: Re: [HACKERS] Chinese in Postgres

From: "ciifrancesco(at)tiscali(dot)it" <ciifrancesco(at)tiscali(dot)it>
To: "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: R: 回复: R: Re: [HACKERS] Chinese in Postgres
Date: 2013-08-16 13:29:41
Message-ID: 8627870.21411376659781728.JavaMail.defaultUser@defaultHost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-ru-general pgsql-zh-general

[I reply to both in one email]

Song:
that C++ program has a log file.
In the log file the queries look like this:
UPDATE MY_table SET
UTF8_field =
'<e5><8f><b0><20><31><32><33><34><27><20><57><48><45><52><45><20><49><44><20><3d><20><31>

starting from the first chinese letter, all the rest of the query is
in hexa.
But this is not a problem, because the query is inserted fine
(excepted the chinese letter). And if i use a hexa converter, i get the
correct query:

UPDATE MY_table SET UTF8_field = '台 1234' WHERE ID = 1

Hannu:
the length in the database is counting each of the empty
squares:

UTF8_field | length
------------+--------
��� 1234
| 8

cheers
Francesco

----Messaggio originale----
Da:
mark3536(at)yahoo(dot)cn
Data: 16/08/2013 14.52
A: "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>
Ogg:
回复: [pgsql-zh-general] R: Re: [HACKERS] Chinese in Postgres

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/

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

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/

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2013-08-16 14:42:05 Re: LDAP: bugfix and deprecated OpenLDAP API
Previous Message Song 2013-08-16 12:52:59 回复: [pgsql-zh-general] R: Re: [HACKERS] Chinese in Postgres

Browse pgsql-ru-general by date

  From Date Subject
Next Message Rural Hunter 2013-08-17 06:16:29 Re: R: Re: [HACKERS] Chinese in Postgres
Previous Message Song 2013-08-16 12:52:59 回复: [pgsql-zh-general] R: Re: [HACKERS] Chinese in Postgres

Browse pgsql-zh-general by date

  From Date Subject
Next Message Rural Hunter 2013-08-17 06:16:29 Re: R: Re: [HACKERS] Chinese in Postgres
Previous Message Song 2013-08-16 12:52:59 回复: [pgsql-zh-general] R: Re: [HACKERS] Chinese in Postgres