encoding again

From: Kathy Zhu <Kathy(dot)Zhu(at)Sun(dot)COM>
To: pgsql-general(at)postgresql(dot)org
Subject: encoding again
Date: 2003-09-09 17:32:57
Message-ID: 200309091733.h89HX0c24340@amon.Central.Sun.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi, sorry that this email is a little bit long, but it is actully not :-))

**** I have a database 'unidb' created with -E UNICODE.

$ psql -l
List of databases
Name | Owner | Encoding
-----------+---------+-----------
unidb | kathy | UNICODE

**** I input Chinese data in unicode form. E.g.
logging-threshold=\u65e5\u5fd7\u9608\u503c
polling_setting_error=\u8bbe\u7f6e\u8f6e\u8be2\u95f4\u9694\u65f6\u51fa\u9519

unidb=# show client_encoding;
NOTICE: Current client encoding is 'UNICODE'
SHOW VARIABLE

unidb=# select * from testbytes;
name | value
-------------------------+-------------------------
logging_setting_error | 设置æ¥å¿éå¼æ¶åºé
polling_setting_error | 设置轮询é´éæ¶åºé

**** When I retrieve data, I did

unidb=# set client_encoding to 'EUC_CN';
unidb=# show client_encoding;
NOTICE: Current client encoding is 'EUC_CN'
SHOW VARIABLE

unidb=# select * from testbytes order by value;
name | value
-------------------------+-------------------------
logging_setting_error | ־ֵʱ
polling_setting_error | ѯʱ

Three problems here:
1) the sorting is based on unicode value, not EUC_CN encoding value.
2) I wrote the ResultSet to a file by using OutputStreamWriter(file, "EUC_CN"). The
file is not readable from the browser with any charset setting.
3) Changing client_encoding from UNICODE to EUC_CN actually alter/loose the data if
you compare the above "select *" statements.

I wonder why this happens ?? According to the doc, automatic encoding coversion
between UNICODE and EIC_CN is supported.

Any help is highly appreciated.
thanks,
kathy

Responses

Browse pgsql-general by date

  From Date Subject
Next Message snpe 2003-09-09 17:32:58 Oracle and regular expressions ???
Previous Message Greg Stark 2003-09-09 17:15:59 any chance of "like ANY (array[])" like the "= ANY (array[])" syntax?