I am currently doing some testing with the output CSV file for Shift-JIS format, but somehow i found it weird on the trials of differences japanese characters as below :
My code :
try {
String dat2 = "カヨ ハラダ";
String dat = "2バイト文字出力";
String fileName = "C:/Users/CR/Desktop/test2.txt";
FileOutputStream fos = new FileOutputStream(fileName);
OutputStreamWriter osw = new OutputStreamWriter(fos, "Shift_JIS");
BufferedWriter fp = new BufferedWriter(osw);
fp.write(new String(dat2.getBytes("Shift_JIS"));
fp.newLine();
fp.flush();
fp.close();
fos.close();
} catch (Exception ex) {
throw new Exception(ex);
}
Result for dat2 :
It was not in Shift-JIS format and the words are incorrect too whereby another trial :
Result for dat :
This can be displayed correctly and in the expected format too.
Anything went wrong ? or the content is not correct ?
Thanks !