Re:   Hi, ever

From: "stevegy" <stevegy(at)126(dot)com>
To: pgsql-general(at)postgresql(dot)org
Cc: "martijn van oosterhout" <kleptog(at)svana(dot)org>
Subject: Re: &nbsp;&nbsp;Hi,&nbsp;ever
Date: 2006-10-03 23:50:12
Message-ID: 4522F734.000023.27980@bj126app8.126.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)postgresql(dot)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(at)svana(dot)org> http://svana.org/kleptog/

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message elein 2006-10-04 00:52:43 Re: Performance and Generic Config after install
Previous Message Chris Hoover 2006-10-03 20:49:02 Help with function