Re:   Hi, ever

Поиск
Список
Период
Сортировка
От stevegy
Тема Re:   Hi, ever
Дата
Msg-id 4522F734.000023.27980@bj126app8.126.com
обсуждение исходный текст
Ответ на Re: Hi, everyone. can i ask a question for th e server side encoding GB18030 and sort order?  (Martijn van Oosterhout <kleptog@svana.org>)
Ответы Re:   Hi, ever  (Martijn van Oosterhout <kleptog@svana.org>)
Список pgsql-general
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 need to 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"
抄送:pgsql-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 range EUC_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 to litigate.






3G 时 代 来 临 了,坚 决 对 传 统 邮 箱 说 不 !
新 一 代 极 速 3G 邮 箱 闪 亮 登 场 ,280 兆 网 盘 免 费 送 ! 点 击 此 处 注 册

В списке pgsql-general по дате отправления:

Предыдущее
От: Erik Jones
Дата:
Сообщение: Re: Need help with a function from hell..
Следующее
От: elein
Дата:
Сообщение: Re: Performance and Generic Config after install