@@ -609,6 +609,9 @@ def closure_compiler(filename, advanced=True, extra_closure_args=None):
609
609
# Tell closure never to inject the 'use strict' directive.
610
610
args += ['--emit_use_strict=false' ]
611
611
args += ['--assume_static_inheritance_is_not_used=false' ]
612
+ # Always output UTF-8 files, this helps generate UTF-8 code points instead of escaping code points with \uxxxx inside strings.
613
+ # Closure outputs ASCII by default, and must be adjusted to output UTF8 (https://github.com/google/closure-compiler/issues/4158)
614
+ args += ['--charset=UTF8' ]
612
615
613
616
if settings .IGNORE_CLOSURE_COMPILER_ERRORS :
614
617
args .append ('--jscomp_off=*' )
@@ -669,7 +672,8 @@ def move_to_safe_7bit_ascii_filename(filename):
669
672
# 7-bit ASCII range. Therefore make sure the command line we pass does not contain any such
670
673
# input files by passing all input filenames relative to the cwd. (user temp directory might
671
674
# be in user's home directory, and user's profile name might contain unicode characters)
672
- proc = run_process (cmd , stderr = PIPE , check = False , env = env , cwd = tempfiles .tmpdir )
675
+ # https://github.com/google/closure-compiler/issues/4159: Closure outputs stdout/stderr in iso-8859-1 on Windows.
676
+ proc = run_process (cmd , stderr = PIPE , check = False , env = env , cwd = tempfiles .tmpdir , encoding = 'iso-8859-1' if WINDOWS else 'utf-8' )
673
677
674
678
# XXX Closure bug: if Closure is invoked with --create_source_map, Closure should create a
675
679
# outfile.map source map file (https://github.com/google/closure-compiler/wiki/Source-Maps)
0 commit comments