views:

19

answers:

1

Up to this moment, I still have no luck to resolve this Chinese characters issue. I am using OC4J 9.0.4.1 with Oracle 10g Database (that is created with UTF-8). The situation is that my JSP page is set with pageencoding = UTF-8 already.

I save some Chinese characters from web page to database (varchar2 column) via Thin Driver. In iSQLPlus, those Chinese characters cannot be shown. Then the content is retrieved by using ResultSet.getString. When the content is placed back to JSP Page, it shwos monster characters.

Anyone can help ?

The background information of the settings: NLS_LANGUAGE AMERICAN
NLS_TERRITORY AMERICA
NLS_CHARACTERSET AL32UTF8
NLS_LENGTH_SEMANTICS BYTE
NLS_NCHAR_CHARACTERSET AL16UTF16
NLS_RDBMS_VERSION 10.2.0.1.0
System.getProperty("file_encoding") = MS950

Anyone can help ?

A: 

I save some Chinese characters from web page to database (varchar2 column) via Thin Driver. In iSQLPlus, those Chinese characters cannot be shown

You need to set the request body encoding to the same encoding as the pageEncoding of the JSP before obtaining the parameters.

request.setCharacterEncoding("UTF-8");

Note that the above applies on POST requests only (I expect you're using POST here), for GET request parameters you need to configure it in the servletcontainer level.

See also:

BalusC
But ... they are JSP pages that directly get String from Oracle Database via thin driver and shown on browser. Those parameters are not from request.
SkyEagle888
You told that you **saved** some characters from web page to database and that they cannot be shown in iSQLPlus. So something went wrong during saving.
BalusC
Yes, I need to do soemthing special during saving ? I use:sqlStr = "UPDATE blah blah blah"stmt = dbConn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);intResult = stmt.executeUpdate(sqlStr);
SkyEagle888
No. You need to ensure that the submitted data is been processed as UTF-8 everywhere. See my answer and if necessary also the link in it.
BalusC
Thanks for you help. Your answer solved my problem.
SkyEagle888
You're welcome.
BalusC