Reputation: 3
I am working on a Java application which creates .docx files using Apache POI. However, "äöü" is not correctly displayed in the word file when I open it manually from the Intelij navigation after it was created. Do you have an idea what I might want to check/amend?
public void generateProtocolTEST() throws IOException {
if (!Paths.get("./protocols").toFile().exists()) Files.createDirectories(Paths.get("./protocols"));
XWPFDocument document = new XWPFDocument();
FileOutputStream out = new FileOutputStream("protocols/" + "test.docx");
document.createParagraph().createRun().setText("äüö");
document.write(out);
out.close();
}
Solution:
Upvotes: 0
Views: 229
Reputation: 3782
If you didn't have UTF-8
set in IntelliJ before, you might have to recreate the .java
file, which contains the code you show in your question (a restart of the IDE would probably also be a good idea), as changed encoding settings are effective for new files only.
Upvotes: 1