Tag Archives: Iso

WriteISOLatin1

Introduction

This example shows how your Java Application can write  ISO-Latin-1 encoded text to a file.  Please note the difference of this and the UTF-8 method. Both are identical, except for the FileOutputStreamWriter Object, which takes the charset  in it’s Constructor.

try {
    Writer out = new BufferedWriter(
        new OutputStreamWriter(new FileOutputStream("outfilename"), "8859_1"));
    out.write(aString);
    out.close();
} catch (UnsupportedEncodingException e) {
} catch (IOException e) {
}