This week's book / license giveaways are in the JDBC and Relational Databases and Java in General forums.
We're giving away four copies each of PostGIS in Action and Java Advanced Topics Training and have the authors on-line!
See this thread and this one for details.
The moose likes Servlets and the fly likes Inserting Japanese text into Oracle database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "Inserting Japanese text into Oracle database" Watch "Inserting Japanese text into Oracle database" New topic
Author

Inserting Japanese text into Oracle database

Kirtikumar Puthran
Ranch Hand

Joined: Mar 04, 2003
Posts: 37
Hi,
I apologise if this is not the right forum to ask this question.
I am trying to insert Japanese data retrieved from a JSP page having
"shift-jis" charset into an UTF-8 oracle database.
I am using the following code to get the user input from the Form text box
field as follows:
String textboxString = request.getParameter("japaneseText");
String original = new
String(textboxString.getBytes("8859_1"));
byte[] JISBytes = original.getBytes("Shift_JIS");
String insertToDB = new String(JISBytes, "UTF8");
The string is then inserted in a UTF-8 database
But when the string is retrieved from the database using Java or Perl code,
the result is seen as junk "Mojibake" characters.
Note : When the data is inserted using a Perl script, the data is inserted
properly and the results are also retrieved properly in Japanese characters.
I would appreciate if someone could throw some pointers on this issue. (Even tried this using a servlet )


Regards,<br />Kirti
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17261
    
    6

Good tough question, and yes it does not belong in this forum.
I am going to move this to the Oracle forum.
Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Inserting Japanese text into Oracle database