How to encode to windows 1252 in Java while writing to the file? -
if encode data in windows-1252 format , write file, how set content type in java?
you can use outputstreamwriter.
writer out = new outputstreamwriter(new fileoutputstream(yourfile), "windows-1252"); use typical writer methods write output file (or wrap it, or declare outputstreamwriter).
the constructor accepts charset instead of string charset name. can so
charset windows1252 = charset.forname("windows-1252");
Comments
Post a Comment