Affects PMD Version: 7.8.0
Description:
pmd --version
doesn't look nice. But if you have a custom ruleset with custom rule messages, that use UTF-8, then the output on the console is broken.
Eg. ruleset:
<?xml version="1.0" encoding="utf-8"?> <ruleset name="Custom Rules" xmlns="http://pmd.sourceforge.net/ruleset/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd"> <description> My custom rules </description> <rule ref="category/java/bestpractices.xml/AbstractClassWithoutAbstractMethod" message="This is a Ümlaut." /> </ruleset>
When running PMD in a windows command prompt, the output looks like this:
> pmd --version
ΓûêΓûêΓûêΓûê ΓûêΓûêΓûêΓûê
ΓûêΓûê ΓûêΓûê
ΓûêΓûê ΓûêΓûêΓûêΓûêΓûê Γûê ΓûêΓûêΓûê ΓûêΓûêΓûê ΓûêΓûêΓûêΓûêΓûêΓûêΓûê ΓûêΓûê
ΓûêΓûêΓûê ΓûêΓûê ΓûêΓûêΓûê ΓûêΓûêΓûêΓûê ΓûêΓûêΓûêΓûê ΓûêΓûê ΓûêΓûê ΓûêΓûêΓûê
ΓûêΓûêΓûê ΓûêΓûêΓûêΓûêΓûêΓûêΓûê ΓûêΓûê ΓûêΓûêΓûêΓûê ΓûêΓûê ΓûêΓûê ΓûêΓûê ΓûêΓûêΓûê
ΓûêΓûê ΓûêΓûê ΓûêΓûê ΓûêΓûê ΓûêΓûê ΓûêΓûêΓûêΓûêΓûêΓûêΓûê ΓûêΓûê
ΓûêΓûê ΓûêΓûê
ΓûêΓûêΓûêΓûê ΓûêΓûêΓûêΓûê
PMD 7.8.0 (f80ec21752b094bdccb041cc545e21a369e00ac6, 2024-11-29T09:58:44Z)
Java version: 21.0.5, vendor: Eclipse Adoptium, runtime: C:\Users\adangel\openjdk\jdk-21.0.5+11
> pmd check --no-cache --no-progress -d sources\test-project\src -R sources\test-project\myruleset.xml
sources\test-project\src\MyClass.java:1: AbstractClassWithoutAbstractMethod: This is a Ümlaut.
The correct output after executing chcp 65001
is:
> pmd --version
████ ████
██ ██
██ █████ █ ███ ███ ███████ ██
███ ██ ███ ████ ████ ██ ██ ███
███ ███████ ██ ████ ██ ██ ██ ███
██ ██ ██ ██ ██ ███████ ██
██ ██
████ ████
PMD 7.8.0 (f80ec21752b094bdccb041cc545e21a369e00ac6, 2024-11-29T09:58:44Z)
Java version: 21.0.5, vendor: Eclipse Adoptium, runtime: C:\Users\adangel\openjdk\jdk-21.0.5+11
> pmd check --no-cache --no-progress -d sources\test-project\src -R sources\test-project\myruleset.xml
sources\test-project\src\MyClass.java:1: AbstractClassWithoutAbstractMethod: This is a Ümlaut.
Note, that redirecting the output (using > report.xml
) or just writing the report into a file using -r report.xml
produces correct output. It seems to be only the display in the console window.
Running PMD through: CLI
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4