回答編集履歴

1

コード例に"UTF-8"の指定が漏れていたので追記

2017/01/27 00:27

投稿

KSwordOfHaste
KSwordOfHaste

スコア18394

test CHANGED
@@ -44,7 +44,7 @@
44
44
 
45
45
  FileOutputStream fos = new FileOutputStream("...");
46
46
 
47
- OutputStreamWriter osw = new OutputStreamWriter(fos);
47
+ OutputStreamWriter osw = new OutputStreamWriter(fos, "UTF-8");
48
48
 
49
49
  osw.write('\uFEFF');
50
50
 
@@ -62,7 +62,7 @@
62
62
 
63
63
  FileOutputStream fos = new FileOutputStream("...");
64
64
 
65
- OutputStreamWriter osw = new OutputStreamWriter(fos);
65
+ OutputStreamWriter osw = new OutputStreamWriter(fos, "UTF-8");
66
66
 
67
67
  osw.write("日本語");
68
68