Checkstyle plugin how to set codepage


(Klaus Christiansen) #1

Im running checktyle 6.19 in gradle 3.0

I have some Java code with variables containing danish characters like: ‘Æ’ or ‘ø’.
The result is that checkstyle fails.

Caused by: C:\GeneratedCode\generated-sources\dk\xact\test\record1\OhShadow.java:6068:53: Unexpected character 0x2020 in identifier
at com.puppycrawl.tools.checkstyle.grammars.GeneratedJavaLexer.nextToken(GeneratedJavaLexer.java:405)
at antlr.TokenStreamHiddenTokenFilter.consume(TokenStreamHiddenTokenFilter.java:38)
at antlr.TokenStreamHiddenTokenFilter.nextToken(TokenStreamHiddenTokenFilter.java:134)
at antlr.TokenBuffer.fill(TokenBuffer.java:69)

Is there a way to set file codepage/encoding for the checkstyle task?


(Klaus Christiansen) #2

I found it. I added a property “charset” to my checkstyle config xml file.

<module name="Checker">
    <property name="charset" value="UTF-8"/>
...
</module>