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.