[Bugfix] 修复 #6348 资源包管理处理非UTF-8编码的options.txt文件时出错#6351
Conversation
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 34d122b4b8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c1c167216f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (detected == null || !detected.isSupported()) return OperatingSystem.NATIVE_CHARSET; | ||
| var charset = detected.getCharset(); | ||
| if (charset == StandardCharsets.UTF_8 || charset == StandardCharsets.US_ASCII) return StandardCharsets.UTF_8; | ||
| return OperatingSystem.NATIVE_CHARSET; |
There was a problem hiding this comment.
Preserve the detected non-UTF-8 charset
When options.txt is encoded in a supported non-UTF-8 charset that differs from the current JVM native charset, such as an instance copied from a GBK Windows machine to a UTF-8 Linux/macOS install or a UTF-16 file with a BOM, this branch discards the charset UniversalDetector found and forces loadOptions() to decode with OperatingSystem.NATIVE_CHARSET. That still produces mojibake before the resource pack lists are parsed and later rewritten, so the non-UTF-8 fix only works when the file happens to match the local native charset; return the detected charset for supported non-ASCII encodings instead of falling back here.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
无需担心,这种情况MC也读取不了,就不管了(

Fixes #6348