UTF-8 issue with excel

51 Views Asked by At

I am trying to make excel recognize UTF-8 file and exporting file with UTF-8-BOM file with code

BufferedWriter bufferedWriter = new BufferedWriter(
        new OutputStreamWriter(new FileOutputStream(pathToFile.toString()), StandardCharsets.UTF_8));
bufferedWriter.write('\ufeff');
bufferedWriter.write(content);
bufferedWriter.flush();
bufferedWriter.close();

I have this characters

みなさん、こんにちは、ここであなたたちを見つけました、これは地球上で最も素晴らしい場所です、パン、空気、水、リンゴ、塩がすべて揃っています。

which have issue enter image description here

and when I am trying to open created file with excel it is recognizes as ASII instead of UTF-8. How to make excel open file as UTF-8?

I tried to add bufferedWriter.write('\ufeff'); to make exported file UTF_8_BOM which is not helpful.

0

There are 0 best solutions below