From 57c37c222c43f732c8b7703263cf9a573561322f Mon Sep 17 00:00:00 2001 From: Juuz Date: Wed, 3 Sep 2025 13:59:45 +0300 Subject: Always specify locale in toUpperCase and toLowerCase (#556) Not all of these changes are strictly needed to avoid the Turkish i issue specifically, but it's good to be consistent.--- enigma-cli/src/main/java/cuchaz/enigma/command/Command.java | 3 ++- .../src/main/java/cuchaz/enigma/command/MappingCommandsUtil.java | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'enigma-cli') diff --git a/enigma-cli/src/main/java/cuchaz/enigma/command/Command.java b/enigma-cli/src/main/java/cuchaz/enigma/command/Command.java index 06c4916..53b277f 100644 --- a/enigma-cli/src/main/java/cuchaz/enigma/command/Command.java +++ b/enigma-cli/src/main/java/cuchaz/enigma/command/Command.java @@ -5,6 +5,7 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import java.util.Locale; import net.fabricmc.mappingio.MappingReader; import net.fabricmc.mappingio.tree.MemoryMappingTree; @@ -56,7 +57,7 @@ public abstract class Command { protected static EntryTree readMappings(Path path, ProgressListener progress, MappingSaveParameters saveParameters) throws IOException, MappingParseException { // Legacy - if (path.getFileName().toString().toLowerCase().endsWith(".zip")) { + if (path.getFileName().toString().toLowerCase(Locale.ROOT).endsWith(".zip")) { return MappingFormat.ENIGMA_ZIP.read(path, progress, saveParameters, null); } diff --git a/enigma-cli/src/main/java/cuchaz/enigma/command/MappingCommandsUtil.java b/enigma-cli/src/main/java/cuchaz/enigma/command/MappingCommandsUtil.java index e1e216a..7c6bf43 100644 --- a/enigma-cli/src/main/java/cuchaz/enigma/command/MappingCommandsUtil.java +++ b/enigma-cli/src/main/java/cuchaz/enigma/command/MappingCommandsUtil.java @@ -4,6 +4,7 @@ import java.io.IOException; import java.io.UncheckedIOException; import java.nio.file.Files; import java.nio.file.Path; +import java.util.Locale; import net.fabricmc.mappingio.MappingWriter; import net.fabricmc.mappingio.tree.VisitableMappingTree; @@ -34,7 +35,7 @@ public final class MappingCommandsUtil { MappingFormat format = null; try { - format = MappingFormat.valueOf(type.toUpperCase()); + format = MappingFormat.valueOf(type.toUpperCase(Locale.ROOT)); } catch (IllegalArgumentException ignored) { if (type.equals("tinyv2")) { format = MappingFormat.TINY_V2; @@ -101,7 +102,7 @@ public final class MappingCommandsUtil { MappingFormat format = null; try { - format = MappingFormat.valueOf(type.toUpperCase()); + format = MappingFormat.valueOf(type.toUpperCase(Locale.ROOT)); } catch (IllegalArgumentException ignored) { // ignored } -- cgit v1.2.3