Hello Ramesh!

RK> Hi all,

RK> Its the korean character set again. when i try to
RK> insert a set of korean characters into os/390, it
RK> inserts all junk characters.
RK> till the db access it is fine but after inserting into
RK> the database i read and it gives alljunk sets.
RK> i am using euc_kr character encoding in my jsp pages.

RK> is it possible if i try to insert them as unicode?
RK> if so how will i convert the user input (in any
RK> language) to unicode values.

RK> any light on this is highly appreciated

Have had similar problems with another db.
1. You should get the parameters correctly from the
   web form. (http://tagunov.tripod.com/i18n/i18n.html)

   To test if it's all okay try outputting the value
   you have obtained back to the resulting html page.

   Also print out the Unicode codes of the characters
   in your string:

   for (int i=0; i<s.length(); ++i){
     out.write( Integer.toString( (int)s.charAt(i) ) ); out.write(" ");
   }

   and check them against the description of the
   Unicode charset to make sure these are really
   corean characters, not garbagge.

   (Maybe you can download the unicode description
   from somewhere at http://www.unicode.org, sorry,
   do not know the exact link).

2. Your JDBC driver should put the parameter to the
   database correctly. Internally Java keeps all
   characters in Unicode and I hope that IBM
   JDBC drivers should deal with them correctly.

   As a last resort you could use PreparedStatement and do

   stmt.setBytes( 1, s.getBytes("EUC_KR") );

   instead of

   stmt.setString( 1, s );

   we used it with a very obsolete and miserable
   database, Intersystems Cache', but then
   we were sure that there JDBC drivers couldn't
   do the required conversions themselves.

   I have much more faith in IBM software and
   beleive that their JDBC drivers should
   do the trick.

   What encoding are your database tables configured
   keep data in?

Best regards, Anton Tagunov

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to