wood burning stoves 2.0*
The moose likes JDBC and the fly likes Encoding Conversion using JDBC Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Encoding Conversion using JDBC" Watch "Encoding Conversion using JDBC" New topic
Author

Encoding Conversion using JDBC

M A Mujeeb
Greenhorn

Joined: Aug 05, 2010
Posts: 11
Hi,

I am trying to access data from an Oracle database where the NLS CharacterSet is set as 'AR8MSWIN1256' where the data is in Arabic.
I am trying to access the data from the database using JDBC and displaying it. But instead of showing up the proper Arabic data it displays Junk characters.

Does JDBC provides any support to convert the character-set? How do i resolve this issue?

Thanks.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Java will not change the encoding. How are you displaying it?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
M A Mujeeb
Greenhorn

Joined: Aug 05, 2010
Posts: 11
I am accessing data using Java connection, quering the database to retrieve the records and displaying them on eclipse editor console.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15959
    
  19

Java works in Unicode and therefore string/character JDBC works with Unicode, however a lot of databases use some specific codepage. I know to my sorrow for example, that you select the codepage when you create a PostgreSQL database, and it's immutable thereafter.

So sometimes you may need a little help in character set translation.

However, Eclipse isn't a word processor, so there are going to be limits on what it will do. You can select a more appropriate code page for a view display - meaning one that maps the characters in question to appropriate display glyphs. But the underlying data will remain the same.


Customer surveys are for companies who didn't pay proper attention to begin with.
M A Mujeeb
Greenhorn

Joined: Aug 05, 2010
Posts: 11
Thanks for your input Tom. I will probably use xhtml or a jsp as a code base for viewing the data.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Encoding Conversion using JDBC
 
Similar Threads
Help - Data visibility in Weblogic and JDBC connection problem
JDBC unicode conversion issue
how to export PDF report within the Arabic and English data through jsp code.
Read Arabic text in Servlet
problem inserting arabic data