convert string encoding from big5 to utf8

godman_polly
godman_polly used Ask the Experts™
on
Hi,

    Is it possible to convert a string encoding from big5 to utf-8? I try to use
BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream("big5"), "BIG5")); to read the big5 strings and then use
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream("utf8"), "UTF8"));
to output the strings into a file called "utf8". The encoding of the strings in the file is correctly utf-8.

What I want to do is to insert UTF-8 strings into oracle9i db. I try to read the strings from the file "utf8" by the above method and insert them into the db directly and "????????" is resulted. I also convert big5 strings into byte[] with utf8 encoding and then convert them into String with specification utf8. The same thing is resulted.

Is there any method provided to me so that I can properly insert utf-8 strings into the oracle 9i db. Thx.

godman

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
what is your database encoding
Is your Database encoding UTF-8? Just checking.... Also it helps to run your java program with UTF-8 Encoding. Like this...

java -Dfile.encoding="UTF-8" yourClass

Hope it helps.

Best Regards,

Manish

Author

Commented:
I still cannot store UTF-8 strings into the db. I would ask the system adm. to check the default encoding of the db.

Godman

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial