diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/doclets/CheckDocsDoclet.java b/src/main/java/com/puppycrawl/tools/checkstyle/doclets/CheckDocsDoclet.java index 69e1d227f..1872560dc 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/doclets/CheckDocsDoclet.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/doclets/CheckDocsDoclet.java @@ -19,10 +19,12 @@ package com.puppycrawl.tools.checkstyle.doclets; import java.io.File; -import java.io.FileWriter; +import java.io.FileOutputStream; import java.io.IOException; +import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.io.Serializable; +import java.io.Writer; import java.util.Arrays; import java.util.Comparator; import com.sun.javadoc.ClassDoc; @@ -165,8 +167,9 @@ public final class CheckDocsDoclet final File destDir = new File(getDestDir(root.options())); final File checksIndexFile = new File(destDir, "checks.xml"); - final PrintWriter fileWriter = new PrintWriter( - new FileWriter(checksIndexFile)); + final Writer writer = + new OutputStreamWriter(new FileOutputStream(checksIndexFile), "UTF-8"); + final PrintWriter fileWriter = new PrintWriter(writer); writeXdocsHeader(fileWriter, "Available Checks"); fileWriter.println("
Checkstyle provides many checks that you can"
diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/doclets/TokenTypesDoclet.java b/src/main/java/com/puppycrawl/tools/checkstyle/doclets/TokenTypesDoclet.java
index 9354ad5cd..4eb161b12 100644
--- a/src/main/java/com/puppycrawl/tools/checkstyle/doclets/TokenTypesDoclet.java
+++ b/src/main/java/com/puppycrawl/tools/checkstyle/doclets/TokenTypesDoclet.java
@@ -21,6 +21,7 @@ package com.puppycrawl.tools.checkstyle.doclets;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.PrintStream;
+import java.io.UnsupportedEncodingException;
import com.sun.javadoc.ClassDoc;
import com.sun.javadoc.DocErrorReporter;
@@ -51,15 +52,18 @@ public final class TokenTypesDoclet
* @param root RootDoc given to the doclet
* @exception FileNotFoundException will be thrown if the doclet
* will be unable to write to the specified file.
+ * @exception UnsupportedEncodingException will be thrown if the doclet
+ * will be unable to use UTF-8 encoding.
* @return true if the given RootDoc is processed.
*/
- public static boolean start(RootDoc root) throws FileNotFoundException
+ public static boolean start(RootDoc root)
+ throws FileNotFoundException, UnsupportedEncodingException
{
final String fileName = getDestFileName(root.options());
final FileOutputStream fos = new FileOutputStream(fileName);
PrintStream ps = null;
try {
- ps = new PrintStream(fos);
+ ps = new PrintStream(fos, false, "UTF-8");
final ClassDoc[] classes = root.classes();
if (classes.length != 1
|| !"TokenTypes".equals(classes[0].name()))