Home » Developer & Programmer » JDeveloper, Java & XML » Character sets again
Character sets again [message #91960] Thu, 18 December 2003 03:33 Go to next message
Con
Messages: 1
Registered: December 2003
Junior Member
I'm working on a web service (JSP) that queries data from several database in different countries using different code pages. I thought I had a problem with a particular database but I've narrowed it down to a Java or JDBC problem by building a simple GUI query app with java (no JSP or tomcat involved).
The database initially causing the problem has NLS_CHARACTERSET = EE8ISO8859P2 and I tried several values for NLS_LANG including EE8ISO8859P2 (as produces the correct results in TOAD or SQL*plus) and UTF8.
If I do a simple select chr(138) from dual I expect to get 'Š' (S with upside-down circumflex) returned as I do in TOAD but instead I get a block symbol '�' (value 65533 when cast to int in java).
If I do 'insert chr(138) into table' using JDBC the correct character gets inserted so I think the problem occurs during the conversion of the result set values to their Unicode representation. I retrieve the values using resultset.getString(), if I use getBytes() and look at the first byte the value is -17 instead of 138 which is what I would expect.
Trying to track the problem down I've done many tests using different client systems and accessing various databases and using various NLS_LANG values (OCI and thin client) but I always get the same results. Performing a simple "select chr(nnn) from dual" using a value nnn between 128 and 159 returns an unrecognizable character in Java/JDBC.
The same query in TOAD or SQL*plus returns a correct character depending on the database and NLS_LANG setting.
Is this a Java/JDBC bug?
Can anyone verify this?
Thanks Con
Re: Character sets again [message #92425 is a reply to message #91960] Fri, 09 July 2004 06:25 Go to previous message
Benny Derous
Messages: 1
Registered: July 2004
Junior Member
You should use NLS_LANG=AMERICA_AMERICA.EE8MSWIN1250 since this special s is covered by this character set. This is not the case with EE8ISO8859P2.

Or use CZECH_CZECH REPUBLIC.EE8MSWIN1250

Good luck and hope this helps.

Benny Derous
Previous Topic: Unable to load the java Stored procedure Error ORA : 03113
Next Topic: ORA-29532: Java call terminated by uncaught Java exception Error For oracle 9.2.0.1.0 for Red Hat Li
Goto Forum:
  


Current Time: Thu Apr 25 16:08:51 CDT 2024