Skip to content

Commit 1b6826e

Browse files
committed
Use COMPAT locale on newer JVMs
1 parent 5629bd4 commit 1b6826e

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/main/java/org/mcphackers/launchwrapper/tweak/LegacyTweak.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ public LaunchTarget getLaunchTarget() {
124124
downloadServer();
125125
enableLegacyMergeSort();
126126
enableWLToolkit();
127+
if (LaunchClassLoader.CLASS_VERSION >= 64) {
128+
// Minecraft shows unknown unicode symbol in place of U+00A0 (NON-BREAKING SPACE) in dates, force old locale provider to use space
129+
System.setProperty("java.locale.providers", "COMPAT");
130+
}
127131
URLStreamHandlerProxy.setURLStreamHandler("http", new MinecraftURLStreamHandler(config));
128132
URLStreamHandlerProxy.setURLStreamHandler("https", new MinecraftURLStreamHandler(config));
129133
MainLaunchTarget target = new MainLaunchTarget(context.getMinecraft().name, new String[] { config.username.get(), config.session.get() });

src/main/java/org/mcphackers/launchwrapper/tweak/VanillaTweak.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ public boolean handleError(LaunchClassLoader loader, Throwable t) {
5454
@Override
5555
public LaunchTarget getLaunchTarget() {
5656
enableWLToolkit();
57+
// TODO detect if the version we're running already has this fixed?
58+
if (LaunchClassLoader.CLASS_VERSION >= 64) {
59+
// Minecraft shows unknown unicode symbol in place of U+00A0 (NON-BREAKING SPACE) in dates, force old locale provider to use space
60+
// Fixed in 1.12.2??? Breaks in 1.14.4?? Works in 1.20 and above
61+
System.setProperty("java.locale.providers", "COMPAT");
62+
}
5763
URLStreamHandlerProxy.setURLStreamHandler("http", new MinecraftURLStreamHandler(config));
5864
URLStreamHandlerProxy.setURLStreamHandler("https", new MinecraftURLStreamHandler(config));
5965
return new MainLaunchTarget(MAIN_CLASS, context.args);

0 commit comments

Comments
 (0)