// Writing chars > ASCII or ???
import java.io.*;
public class Test8 {
public static void main(String[] args) {
String data =new String("\u00a7\u0080");
// \u0080 written to file as 3F (?) with encoding CP437
// \u0080 written to file as 3F (?) with encoding CP1254
// \u0080 written to file as 80 with encoding 8859_1
System.out.println("data=" + data); //data=§?
String[] codePages = {// "8859_1", "CP1254", //NCR added these
"CP437", "CP737", "CP775", "CP850",
"CP852", "CP855", "CP857", "CP860",
"CP861", "CP862", "CP863", "CP864",
"CP865", "CP866", "CP869", "CP874",
"CP856", "CP858", "CP868", "CP870"
};
try {
FileOutputStream fos = new FileOutputStream("Text8Output.txt"); // write to file
BufferedWriter wr1 = new BufferedWriter(
new OutputStreamWriter(fos, codePages[0]));
//java.io.UnsupportedEncodingException: Cp437 with 1.4.2 OK with 1.6.0
wr1.write(data);
wr1.flush();
wr1.close();
}catch(Exception x) {
x.printStackTrace();
}
} // end main()
} // end class