redpen-cc / redpen

RedPen is an open source proofreading tool to check if your technical documents meet the writing standard. RedPen supports various markup text formats (Markdown, Textile, AsciiDoc, Re:VIEW, reStructuredText and LaTeX).
https://redpen.cc
Apache License 2.0
567 stars 74 forks source link

Kanji is not displayed correctly in Formatter #885

Open marron9999 opened 3 years ago

marron9999 commented 3 years ago

In redpen/redpen-core/src/main/java/cc/redpen/formatter/Formatter.java

ByteArrayOutputStream baos = new ByteArrayOutputStream(); : format(new PrintWriter(baos), docErrorsMap);
: return new String(baos.toByteArray(), StandardCharsets.UTF_8);

I think it depends on the default character encoding of PrintWriter. And, should use OutputStreamWriter.

ByteArrayOutputStream baos = new ByteArrayOutputStream(); OutputStreamWriter osw = new OutputStreamWriter(baos, StandardCharsets. UTF _ 8) : format(new PrintWriter(osw), docErrorsMap);
: return new String(baos.toByteArray(), StandardCharsets.UTF_8);