By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,710 Members | 1,960 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,710 IT Pros & Developers. It's quick & easy.

encoding again

P: n/a
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\u95 f4\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


---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 11 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Kathy Zhu writes:
1) the sorting is based on unicode value, not EUC_CN encoding value.
The sorting is always based on the server encoding. There is no way to
change that.
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.
That is a problem in whatever client interface that is (Java?) or your
browser.
3) Changing client_encoding from UNICODE to EUC_CN actually alter/loose the data if
you compare the above "select *" statements.


You're going to have to be a bit more specific, because many of us can't
identify the characters or see what is wrong with them.

Also, try a more recent PostgreSQL version, such as 7.3.4.

--
Peter Eisentraut pe*****@gmx.net
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 11 '05 #2

P: n/a
Kathy Zhu writes:
1) the sorting is based on unicode value, not EUC_CN encoding value.
The sorting is always based on the server encoding. There is no way to
change that.
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.
That is a problem in whatever client interface that is (Java?) or your
browser.
3) Changing client_encoding from UNICODE to EUC_CN actually alter/loose the data if
you compare the above "select *" statements.


You're going to have to be a bit more specific, because many of us can't
identify the characters or see what is wrong with them.

Also, try a more recent PostgreSQL version, such as 7.3.4.

--
Peter Eisentraut pe*****@gmx.net
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 11 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.