• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to save the result in a different language to a file

 
Anupam Dee
Ranch Hand
Posts: 42
Firefox Browser Tomcat Server Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I am getting a inputstream using
InputStream is = response.getEntity().getContent();
now i want to save it in UTF-8 file that preserves the language codes.
The input stream contains data in a different languages e.g chinese, japanese, hindi.

I tried using IOUtils, OutputStreamWriter but failed. The file is saved but it is something like ऩ Ӓ i want these codes to be actually saved in its equivalent symbol



How can I do this?

Please help.
 
Greg Charles
Sheriff
Posts: 3010
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You will have to first know what encoding the input data uses. Then you can using an InputStreamReader set to use that encoding, and an OutputStreamWriter set to use UTF-8. That should make the translation for you. If both input and output are in UTF-8, and you don't need to work with the data in your Java code, then you can skip both reader and the writer and just copy the bytes from input to output.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!