# 1. Create the Java file (forcing ASCII encoding)
PS D:\issue> Set-Content -Path DummyFile.java -Value "public class DummyFile {}" -Encoding Ascii
# 2. Create the config.xml (with FileLength as a child of Checker)
PS D:\issue> Set-Content -Path config.xml -Value @"
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name="Checker">
<module name="TreeWalker" />
<module name="FileLength">
<property name="max" value="0"/>
</module>
</module>
"@ -Encoding Ascii
# 3. Compile the Java file
PS D:\issue> javac DummyFile.java
# 4. Set PowerShell locale variables as an array
PS D:\issue> $RUN_LOCALE = @("-Duser.language=tr", "-Duser.country=TR")
Output:
Denetleme başlıyor...
[ERROR] D:\issue\DummyFile.java:1: Dosya uzunlu─ƒu 1 sat─▒r (maksimum izin verilen de─ƒer 0). [FileLength]
Denetleme tamamland─▒.
Checkstyle 1 hatayla bitiyor.
Expected Output:
Denetleme başlıyor...
[ERROR] D:\issue\DummyFile.java:1: Dosya uzunluğu 1 satır (maksimum izin verilen değer 0). [FileLength]
Denetleme tamamlandı.
Checkstyle 1 hatayla bitiyor.
The output is garbled (e.g., başlıyor, uzunluğu) because many non-English message files (e.g., messages_tr.properties, messages_ja.properties, messages_de.properties, etc.) contain strings encoded inconsistently.
Some lines use correct Unicode escapes (e.g., \u00f6).
Other lines contain raw UTF-8 or mis-encoded characters (e.g., ğu, ş).
This results in an incorrect display when Checkstyle is run in a non-English locale, as proven by the CLI output above.
Proposed Fix:
To resolve this, all .properties files in src/main/resources/com/puppycrawl/tools/checkstyle/ should be standardized.
Convert all non-English .properties files to a consistent ISO-8859-1 encoding using Unicode escape sequences (\uXXXX) for non-ASCII characters.
Ensure any existing mis-encoded characters (like ba┼ƒl─▒yor) are corrected to their proper ISO-8859-1 representation (like başlıyor).
Output:
Expected Output:
The output is garbled (e.g., başlıyor, uzunluğu) because many non-English message files (e.g., messages_tr.properties, messages_ja.properties, messages_de.properties, etc.) contain strings encoded inconsistently.
Some lines use correct Unicode escapes (e.g., \u00f6).
Other lines contain raw UTF-8 or mis-encoded characters (e.g., ğu, ş).
This results in an incorrect display when Checkstyle is run in a non-English locale, as proven by the CLI output above.
Proposed Fix:
To resolve this, all .properties files in src/main/resources/com/puppycrawl/tools/checkstyle/ should be standardized.
Convert all non-English .properties files to a consistent ISO-8859-1 encoding using Unicode escape sequences (\uXXXX) for non-ASCII characters.
Ensure any existing mis-encoded characters (like ba┼ƒl─▒yor) are corrected to their proper ISO-8859-1 representation (like başlıyor).