View Single Post

   
  #3 (permalink)  
Old 04-09-2008, 11:40 AM
stevegy
 
Posts: n/a
Default Re:   Hi, ever

Hi,

Thank you for your reply.
I guess you mean right. I am continuing find the solution now.
I print all the current locale on my solaris here:
=======================================
-bash-3.00# locale
LANG=zh_CN.GB18030
LC_CTYPE="zh_CN.GB18030"
LC_NUMERIC="zh_CN.GB18030"
LC_TIME="zh_CN.GB18030"
LC_COLLATE="zh_CN.GB18030"
LC_MONETARY="zh_CN.GB18030"
LC_MESSAGES="zh_CN.GB18030"
LC_ALL=
=======================================
My testing database is initdb -E UTF8. And i guess the solaris can not handle the UTF-8 sorting with the LC_COLLATE="zh_CN.GB18030". But i needto prove this.
So i plan to change the locale of my solaris box. I have installed the zh_CN.UTF8 on it. I am looking for a way to change the solaris locale. If this changing need to re-boot machine that I should do this in some not busy time for the live application.

I think I post 2 questions in one post and it's a bad idea. So I post another mail for the convert function error.

Thank you and have a nice day.


-- Steve Yao




-----Ô*ʼÓʼþ-----
·¢¼þÈË:"Martijn van Oosterhout"
·¢ËÍʱ¼ä:2006-10-03 21:51:25
ÊÕ¼þÈË:"stevegy"
³*ËÍgsql-general@postgresql.org
Ö÷Ìâ:Re: [GENERAL] Hi, everyone. can i ask a question for th e server side encoding GB18030 and sort order?


On Tue, Oct 03, 2006 at 04:16:36PM +0800, stevegy wrote:

> I have published my application since a month and I notice the appcation server report a few jdbc errors that says :


> org.postgresql.util.PSQLException: ERROR: character 0xe28094 of encoding "UTF8" has no equivalent in "EUC_CN"


> I think the application user input some kind of characters out of rangeEUC_CN.




That's what the message implies, yes.



> I change my developing test db server to UTF-8 use the initdb


> --encoding=UTF-8 and recreate the testing database with encoding


> utf-8. And this testing db server is host on a windows box the


> encoding is 936(GBK). I restore the data from the pg_dump file. It's


> fine to work and the sort order is fine also. I mean the Chinese


> GB18030 data column is "order by" correctly. But when i do the same


> thing on the Solaris box. I found the sort order is worng. I can fix


> this with a convert function like this: select cname from t_resume


> order by convert(cname using utf8_to_gb18030); on the Solaris box.


> After I use the convert function the order is correct for the Chinese


> characters.




Sortigng is provided by the OS. If your OS can't sort UTF-8, postgres

won't either. But you must make sure that the encoding you specify

during install matches the locale, otherwise funny things happen. You

can't just pick a locale and encoding and expect it to work.



My guess is you have some incompatability there.



> I think I can change all of my sql in the application to fit this


> behavior. But when i run the same sql on the windows box. I get the


> error message: ERROR: could not convert string to UTF-16: error 1113.


> I stick on it!




Windows has yet another way of sorting. Again, make sure the locale

selected matches the encoding you select.



> So, how can I fix this issue? any ideas? Thank you everyone.




Find the locales you're using and make sure they match the encoding

everywhere...



Have a nice day,

--

Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/

> From each according to his ability. To each according to his ability tolitigate.

Reply With Quote