Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: One question about UTF8
lsllcm <lsllcm_at_gmail.com> wrote:
> I have one question about UTF8, I have one db 9207 windows with UTF8
> charset.
>
> We have used jsp page to insert one record with chinese word to table,
> then I try to use sqlplus client to retrieve the record.
>
> When I set the environment variable by using "set
> NLS_LANG=AMERICAN_AMERICA.UTF8", it display incorrect chars,
>
> When I set the environment variable by using "set
> NLS_LANG=AMERICAN_AMERICA.ZHS16CGB231280", it display correct chars,
>
> Can anyone explain it for us?
I think I can.
It depends on the codepage in use at the machine where you start SQL*Plus. There you probably have Chinese GB2312-80 (which is ZHS16CGB231280 for Oracle).
NLS_LANG determins the codepage setting on the client side, not on the
server side.
So what happens is this: UTF8 characters from the database server are
converted to GB2312-80 and sent to the client because Oracle is aware that
this is the codepage in use at the client.
In the first case, where you saw garbage, Oracle believed that UTF8 was the codepage of the client machine too and so did not do any conversion.
Yours,
Laurenz Albe
Received on Tue Jan 17 2006 - 02:13:47 CST
![]() |
![]() |