New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Diff formatting shows weird whitespace characters on Windows 10 (� and ╖ instead of ·) #695
Comments
Thanks for testing in so many places. The formatted diff gets built here, and I'm pretty sure there are no encoding bugs here: spotless/lib-extra/src/main/java/com/diffplug/spotless/extra/integration/DiffMessageFormatter.java Lines 190 to 199 in d033a87
From the
After that, there's no more spotless/plugin-gradle/src/main/java/com/diffplug/gradle/spotless/SpotlessCheck.java Lines 122 to 126 in d033a87
So I'm pretty sure the encoding error is either Gradle, the JVM, or the IDE. Based on that, it seems like the only fix we can do from the spotless side is to make the spotless/lib-extra/src/main/java/com/diffplug/spotless/extra/integration/DiffMessageFormatter.java Line 226 in d033a87
The problem as it stands is that Windows IntelliJ turns that into A few options:
I'd be happy to merge a PR which implements the "safest" option above. If it's been tested in |
I'm happy to test and post updates to see what any option will result. Minor UpdateIn adding a
Definitely seems like it's something specific with Gradle or the JVM when outputting to the console. |
Thanks for testing. The fact that gradle task output is correct, while the terminal build output is incorrect, is confirmation that the terminal encoding is the problem. I'm happy to intentionally misencode if we can reliably detect when to do it, but I don't see how we can. I did a super quick test, and with whatever default font I have on my mac, the Based on this, I'm inclined to either:
I'd be happy to merge a PR from someone that implements 2, or maybe someone figures out a better way forward. |
@nedtwigg I realized in gradle/gradle#18618 that symbols are written directly, they work, but if it using a code, they don't. Have you tried |
I don't think that will help. If someone builds and tests something I'm happy to merge it, but I don't care about this issue. |
I can just confirm I have the same problem. Output on my Win10 machine:
And something similar on our Ubuntu CICD machine:
using: Can it be connected to the encoding of the source code files? |
Summary of problem
When outputting the details of what lines have format violations, the
·
characters representing whitespace are not rendering correctly in the Command Prompt, Android Studio & Intellij's console output on Windows 10. I tried the same project with the same IDEs and Gradle files on Mac OS Catalina and don't see the issue.I use defaults fonts on Windows and in the IDEs. I tried other monospaced fonts and character encoding thinking it's something on my end. Didn't seem to have any effect. I'm suspecting something in the library is possibly using an encoding that isn't translating back to UTF-8 correctly.
Android Studio & Intellij's output (Windows 10)
Command Prompt's output (Windows 10)
Android Studio 4.0's output (Mac OS Catalina)
gradle or maven version
Gradle - 6.1.1
spotless version
5.5.1
operating system and version
copy-paste your full Spotless configuration block(s)
Root project Gradle file
Subproject (app)'s Gradle file
copy-paste the full content of any console errors emitted by
gradlew spotless[Apply/Check] --stacktrace
See summary
The text was updated successfully, but these errors were encountered: