• Post Reply Bookmark Topic Watch Topic
  • New Topic

Saving file in utf-8 format

 
richerd gladius
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I have to open a file and store the same with the same name but in utf- 8 format
can any of you ppl can help me in this
its very urgent for me

Thanks


 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use a FileInputStream to read the file into a byte[]; make sure to specify the proper encoding.

Then use a FileOutputStream using an encoding of "UTF-8" to write the array to a new file.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!