0
クローズコンパイラJava APIを使用して多くのJSファイルをコンパイルしようとしていますが、コマンドラインから呼び出されたときには文字列リテラル<>&=
のこれらの文字はエスケープされます。クロージャコンパイラJava APIエスケープURLエンティティ
CompilerOptions options = new CompilerOptions();
options.setLanguageIn(ECMASCRIPT5);
options.setLanguageOut(ECMASCRIPT5);
options.setOutputCharset(Charset.forName("UTF-8"));
CompilationLevel.SIMPLE_OPTIMIZATIONS.setOptionsForCompilationLevel(options);
SourceFile extern = SourceFile.fromCode("externs.js", "");
SourceFile input = SourceFile.fromCode("input.js", "'<a>'");
Compiler compiler = new Compiler();
compiler.compile(extern, input, options);
System.out.println(compiler.toSource());
これが出力されます。
"\x3ca\x3e";