Guys,
I am having a file in which some of the text was in Unicode format.
I want to read this file (see attachement) in Java and insert into oracle database.
The following is the code for reading the unicode string from the file.
public String loadString(String filename) {
StringBuffer text = new StringBuffer();
FileInputStream instream;
BufferedInputStream buffer;
int readint;
try {
instream = new FileInputStream(filename);
buffer = new BufferedInputStream(instream);
Reader reader = new InputStreamReader(buffer, "Unicode");
while ((readint = reader.read()) != -1) {
text.append( (char) readint);
}
buffer.close();
instream.close();
} catch (Exception e) {e.printStackTrace(); }
return text.toString();
}
Java is reading the correct unicode (i can see this while debuggin the code). Is there any way to insert the Unicode chars to DB.
I am viewing the chars in the html page with Encoding set to 'Central European - Windows).but it doesn't show the correct one..
Please help me how to insert to Oracle DB.
My Oracle DB is UTF-8 charset.
[Updated on: Tue, 08 March 2011 03:48] by Moderator
Report message to a moderator