Skylark interpreter uses Latin1 instead of Utf8 for consistency with Bazel.
RELNOTES: None.
@@ -24,6 +24,7 @@ import com.google.devtools.build.lib.syntax.Printer;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
+import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
@@ -49,8 +50,9 @@ class Skylark {
}
};
+ private static final Charset CHARSET = StandardCharsets.ISO_8859_1;
private final BufferedReader reader =
- new BufferedReader(new InputStreamReader(System.in, StandardCharsets.UTF_8));
+ new BufferedReader(new InputStreamReader(System.in, CHARSET));
private final Mutability mutability = Mutability.create("interpreter");
private final Environment env =
Environment.builder(mutability)
@@ -98,7 +100,7 @@ class Skylark {
public int execute(String path) {
String content;
try {
- content = new String(Files.readAllBytes(Paths.get(path)), StandardCharsets.UTF_8);
+ content = new String(Files.readAllBytes(Paths.get(path)), CHARSET);
BuildFileAST.eval(env, content);
return 0;
} catch (EvalException e) {
