Closed SihenZhang closed 2 years ago
You should be able to encode the file in UTF-8. I remember back in the day I had this issue with minecraft translation files and having to re-encode them using notepad++.
Did you really read what he said?
The language file is encoded in UTF-8, but you have not specified to use UTF-8 to read the file, which in the Chinese area defaults to using GBK encoding to decode.
Describe the bug I was playing
ATM 6 - To the Sky
and I found the crop tier of the custom crops is displayed as gibberish text.Expected behavior After reading the source code, I found that the script is read via
FileReader
that uses Java's platform default encoding. https://github.com/BlakeBr0/MysticalCustomization/blob/a83bd4a6f3907ceb4661394a1c8e92cfb8cb2201/src/main/java/com/blakebr0/mysticalcustomization/loader/CropTierLoader.java#L51-L70 My operating system is Windows 11 in Simplified Chinese, and its default encoding isGBK
, while the encoding of the script file isUTF-8
. Therefore, it displays the gibberish text. Since Java 11FileReader
has gained constructors that accept an encoding:new FileReader(file, charset)
andnew FileReader(fileName, charset)
. In earlier versions of java, you need to usenew InputStreamReader(new FileInputStream(pathToFile), <encoding>)
.Screenshots / Scripts / Logs
magical.json
Versions (please complete the following information):