]> granicus.if.org Git - icu/commitdiff
ICU-21140 Fix cldr-to-icu tooling to work on Windows
authordaniel-ju <daju@microsoft.com>
Tue, 2 Jun 2020 18:22:39 +0000 (14:22 -0400)
committerDavid Beaumont <david.beaumont+github@gmail.com>
Tue, 2 Jun 2020 20:29:31 +0000 (22:29 +0200)
tools/cldr/cldr-to-icu/src/main/java/org/unicode/icu/tool/cldrtoicu/LdmlConverter.java
tools/cldr/cldr-to-icu/src/main/java/org/unicode/icu/tool/cldrtoicu/ant/CleanOutputDirectoryTask.java
tools/cldr/cldr-to-icu/src/main/java/org/unicode/icu/tool/cldrtoicu/ant/ConvertIcuDataTask.java

index 7a5fe8d522eb8732bf8413a5d04266f616cbd30d..ce0b6421012fdc9371612c5fbaab0d63c42b336f 100644 (file)
@@ -242,7 +242,7 @@ public final class LdmlConverter {
 
     private static ImmutableList<String> readLinesFromResource(String name) {
         try (InputStream in = LdmlConverter.class.getResourceAsStream(name)) {
-            return ImmutableList.copyOf(CharStreams.readLines(new InputStreamReader(in)));
+            return ImmutableList.copyOf(CharStreams.readLines(new InputStreamReader(in, UTF_8)));
         } catch (IOException e) {
             throw new RuntimeException("cannot read resource: " + name, e);
         }
index ddd34ea9c8a869c19c0daa075a26e44925742bcb..3c013d64bcb522ccaa9bbffeb6ea735c78c764bc 100644 (file)
@@ -100,8 +100,9 @@ public final class CleanOutputDirectoryTask extends Task {
     }
 
     @SuppressWarnings("unused")
-    public void setRoot(Path root) {
-        this.root = root;
+    public void setRoot(String root) {
+        // Use String here since on some systems Ant doesn't support automatically converting Path instances.
+        this.root = Paths.get(root);
     }
 
     @SuppressWarnings("unused")
index 4fa66fccff7adf387f2177123df93ef5eac50600..1a46ce40eb4d8b315e27abedf7edd2a7fd4f4560 100644 (file)
@@ -16,6 +16,7 @@ import static java.util.stream.Collectors.joining;
 import static org.unicode.cldr.api.CldrPath.parseDistinguishingPath;
 
 import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
@@ -76,13 +77,15 @@ public final class ConvertIcuDataTask extends Task {
     private Predicate<String> idFilter = id -> true;
 
     @SuppressWarnings("unused")
-    public void setOutputDir(Path path) {
-        config.setOutputDir(path);
+    public void setOutputDir(String path) {
+        // Use String here since on some systems Ant doesn't support automatically converting Path instances.
+        config.setOutputDir(Paths.get(path));
     }
 
     @SuppressWarnings("unused")
-    public void setCldrDir(Path path) {
-        this.cldrPath = checkNotNull(path);
+    public void setCldrDir(String path) {
+        // Use String here since on some systems Ant doesn't support automatically converting Path instances.
+        this.cldrPath = checkNotNull(Paths.get(path));
     }
 
     @SuppressWarnings("unused")
@@ -108,8 +111,9 @@ public final class ConvertIcuDataTask extends Task {
     }
 
     @SuppressWarnings("unused")
-    public void setSpecialsDir(Path path) {
-        config.setSpecialsDir(path);
+    public void setSpecialsDir(String path) {
+        // Use String here since on some systems Ant doesn't support automatically converting Path instances.
+        config.setSpecialsDir(Paths.get(path));
     }
 
     @SuppressWarnings("unused")