Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: How can I convert Characterset Properly on JDBC?

Re: How can I convert Characterset Properly on JDBC?

From: Alex Filonov <afilonov_at_yahoo.com>
Date: 18 Apr 2002 15:39:07 -0700
Message-ID: <336da121.0204181439.aa3c301@posting.google.com>


stmkjp_at_hotmail.com (J.P.K) wrote in message news:<d6f86d9c.0204172318.3e0f7a8b_at_posting.google.com>...
> Hi,All.
>
> Current Situation:
> DBMS : Oracle8i Using NLS_CHARACTERSET=AMERICAN_AMERICA.WE8DEC

It's NLS_LANG, isn't it? NLS_CHARACTERSET should look like WE8DEC. Looks like there is a different characterset for NLS_NCHAR_CHARACTERSET. Check if you can access table sys.props$. If so, run the statement: select name, value
from sys.props$
where name like 'NLS%'

>
> I'm Korean and uses KO16KSC5601 characterset, but
> in Pro*C or in SQL*Plus it's ok to use Korean characters
> because I matched NLS_CHARACTERSET with server in environment file.

Sounds a little bit strange. WE8DEC doesn't support Korean characters, as far as I know. Same goes for ISO 8859-1. I wonder how Korean characters are stored in the database. If NLS_NCHAR_CHARACTERSET is set to something which supports Korean characters (starting with KO, 16 or 32 bit charset) that's the characterset actually used in sqlplus and Pro*C. Could you please post NLS_LANG values in server and client environments?

>
> Problem :
> When using JDBC, Korean Chars broken while English chars OK
> in ResultSetObject. ( str = rset.getString(1); returns broken characters)
>
> What I tried :
> String newResult = new String(rset.getBytes("8859_1"),"KSC5601");
> --> some of Korean chars converted well, but still some other's not.
>
> Question :
> 1) I think "8859_1" is not fully compatible with "WE8DEC".

It is. But both only have english alphabet, western european extensions, like ummlauts and accents, numbers and punctuation characters. They don't support Korean characters.

> What characterset alias should I use for getBytes method?
> I tried "WE8DEC", but jvm gave me an UnsupportedEncodingException error.
>
> 2) Is there any other way for obtaining proper results?
> ( except for change DBMS server's NLS_CHARACTERSET, it's rejected by
> Server Admin group...it's SAP ERP DB and they said they don't
> recommend changing Server env. for Reliability...:-( )

Try to test conversion on Oracle side:
Use convert function. It has three parameters, 1st is a string to be converted, 2nd is a source characterset, 3rd is a target characterset. Example:

select convert('abcdef', 'WE8DEC', 'WE8ISO8859P1') from dual

prints abcdef converted from WE8DEC to WE8ISO8859P1.

>
> It's very Urgent Situation and I'll be very appreciate if U can help me.
> Sorry for my poor English grammer, and Thanks in Advance.
Received on Thu Apr 18 2002 - 17:39:07 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US