neoforged / ModDevGradle

A Gradle plugin for developing Minecraft mods using NeoForge
https://projects.neoforged.net/neoforged/moddevgradle
GNU Lesser General Public License v2.1
25 stars 6 forks source link

Running command prints garbage symbols on Windows #8

Closed Nightenom closed 2 months ago

Nightenom commented 2 months ago

Running commands in Windows 11 cmd.exe might suffer from default charset not being utf-8, one can switch using chcp 65001 but setting that globally is still beta (see first image in https://stackoverflow.com/a/57134096) My default chcp is 852, but generally that depends on Windows language

chcp 852: image

chcp 65001: image

Gaming32 commented 2 months ago

I think the only real solution to this is to just not print these fancy characters under an unsupported encoding. Windows charsets don't support fancy characters like these, as they're all single byte charsets that don't support more than 127 characters beyond ASCII.

shartte commented 2 months ago

To summarize a little bit here:

When running under Gradle, the actual chain of output looks like this:

Untitled

In this setup, we have no code running in the Gradle process that is attached to a real console, and cannot change its codepage or cause it to write to the console directly. Sadly that means there is no way for us to fix this.

I opened a Gradle issue for this: https://github.com/gradle/gradle/issues/29356

shartte commented 2 months ago

Since we cannot fix this, I am disabling Emojis for NFRT on Windows and keep them enabled for OSX and Linux. Sole exception: When I detect that I am running via Eclipse or via IntelliJ, I'll enable the Emojis since we know those two redirect the output and do not use a real console.