Skip to content
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

Game logs are now encoded in UTF-8 #2880

Closed
wants to merge 1 commit into from

Conversation

marrrrrrme6
Copy link

fix #2419

Changed codecForLocale() to codecForName("UTF-8")

Signed-off-by: marrrrrrme6 <[email protected]>
@TayouVR
Copy link
Member

TayouVR commented Oct 2, 2024

question is, if that breaks any other codepoints? if someone has their OS set to e.g. that asian one, would that break the logs then if we decode it as UTF-8?
PolyMC/PolyMC#968
3c4b45c

@marrrrrrme6
Copy link
Author

For now, I've added -Dfile.encoding=UTF-8 and tested Japanese.
There were no problems with Japanese.
I don't understand other languages ​​such as Chinese, so could you please test them for me?

@marrrrrrme6
Copy link
Author

The following tests were done on minecraft 1.12.2 and 1.21.1. In 1.12.2, -Dfile.encoding=UTF-8 was added to the arguments.

The issue of garbled characters in sections (§) has been resolved.
1.21.1:
image
1.12.2:
image
MultiMC/Launcher#5435

Chinese, accent aigu and Russian are also no problem.
1.21.1:
image
1.12.2:
image
PolyMC/PolyMC#968 (comment)
MultiMC/Launcher#2998

Special characters are no problem.
1.21.1:
image
1.12.2:
image
PolyMC/PolyMC#806

Use utf-8 is not checked. PolyMC/PolyMC#968 (comment)

@Ryex
Copy link
Contributor

Ryex commented Oct 4, 2024

Wasn't there an issue with using UTF-8 in 1.7 and earlier?
we do want to support those early versions too.

@marrrrrrme6
Copy link
Author

Everything was fine.
I couldn't enter §.
I also tried 1.2.5 and b1.7.3 but the chat wouldn't open.

1.7.10:
image

1.5.2:
image

1.3.2:
image

@Ryex
Copy link
Contributor

Ryex commented Oct 4, 2024

huh. I could have sworn this was brought up before and it broke things...
let's ask @Scrumplex. He has a better memory of the project.

@Scrumplex
Copy link
Member

He has a better memory of the project.

I sadly dont remember

@Ryex
Copy link
Contributor

Ryex commented Oct 4, 2024

alright well, if we're going to add this, -Dfile.encoding=UTF-8 needs to be added as a default java argument or this actually will break things.

@TayouVR
Copy link
Member

TayouVR commented Oct 4, 2024

forgot to send this comment yesterday as I was thinking of asking for some feedback on discord...

then it sounds like the launcher should automatically add that flag.
But I'm not sure if that could cause any issues for anyone

from what you are describing it seems that this should work even with older versions without any issues, so I suppose its fine to blanket apply the flag to every version.
But I'm still skeptical of it working in some really early versions.

I was thinking if we could have a toggle in the settings "Use UTF-8 for log files", which both adds the launch flag and configures the log reader to use UTF-8 instead of the system charset
But I would need other peoples opinions on this.
I'm gonna ask for some input on discord, see if anyone maybe has more to say about this topic

@marrrrrrme6
Copy link
Author

alright well, if we're going to add this, -Dfile.encoding=UTF-8 needs to be added as a default java argument or this actually will break things.

In https://github.com/marrrrrrme6/PrismLauncher/tree/test, I add -Dfile.encoding=UTF-8 to the default arguments, but I'm not sure if this is ok.

@TheKodeToad
Copy link
Member

alright well, if we're going to add this, -Dfile.encoding=UTF-8 needs to be added as a default java argument or this actually will break things.

This will potentially break things too. Since this also controls the encoding for loading files (at least I think it does and the name suggests that) it could mean loading files encoded differently as utf-8...

@marrrrrrme6
Copy link
Author

I am not originally a C++ engineer, and I modified it based on #2419 (comment), but I don't know any more about it than that, so I would like someone to take over.

@TheKodeToad
Copy link
Member

Alright... closing this then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Game log isn't encoded with UTF-8
5 participants