Very big problem -CHARSET
Hi,
I use JDK SE 1.4.0 on WinNT and with Servlet connect to database. I connect with JDBC driver JConnect 5.2. (database - Sybase, Adaptive SQL Anywhere Server 5.5.0 )
Following the instruction I change CHARSET parameter of connection properties:
java.util.Properties props = new java.util.Properties();
props.put("CHARSET_CONVERTER_CLASS","com.sybase.jdbc2.utils.PureConverter");
props.put("CHARSET", "cp1257");
...
connection = java.sql.DriverManager.getConnection (url, props);
...and I get result (no Errors), but I see wrong symbols.
What I do wrong?
It is problem with Java, or with JConnect, or with Sybase SQL Anywhere?
Maybe java.nio.charset will help with this problem?
Thanks very much.
Every answer is helpful
[814 byte] By [
sigoN] at [2007-9-26 1:59:46]

Dear signOn!
I have no experience with Sybase and it's drivers but I want to help you.
1. Are you shure you really have wrong characterset?
There are two parts of rendering symbols: charset of the symbol and charset of rendering device. For example, you can have proper charset in the HTML page, but browser render it in another charset. Did you point your charset in servlet output stream or jsp? There must be something like
contentType="text/html; charset=Cp1257"
2.Try to output your results to the console, which charset is sertainly known.
Try to reveal what charset you really have got by converting it to the console charset with
new String(getBytes(result, console_charset), database_charset);
3. Servlets are woking in ISO8859_1 charset. Try to use this information. But as for me this feature has the influence to the jsp static text only.
4. Proper charset rendering depends on many things. Is your NT locale set to proper country? Did you have proper charset from database with another tool?
Best luck
Alexander