• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

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

 
Ranch Hand
Posts: 42
Firefox Browser Tomcat Server Windows XP
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 3036
12
Mac IntelliJ IDE Python VI Editor Java
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic