Closure compiler does not work on Windows at least if path contains UTF-8 characters
See original GitHub issueIf an input file name contains non-7bit-ASCII characters in it, Closure fails to operate.
STR:
- Install Closure compiler to directory “☃äö Ć € 🦠”. (not mandatory, but for good measure to see if any issues arise from that)
- Pass an input file “☃äö Ć € 🦠.js” to Closure compiler as
--externs
or--js
.
Results in
C:\☃em sd äö Ć € 🦠\emsdk\emscripten\main> dir äö.js
Volume in drive C has no label.
Volume Serial Number is 8847-8E7D
Directory of C:\☃em sd äö Ć € 🦠\emsdk\emscripten\main
03/16/2021 06:18 PM 3,472 äö.js
1 File(s) 3,472 bytes
0 Dir(s) 1,757,394,030,592 bytes free
C:\☃em sd äö Ć € 🦠\emsdk\emscripten\main> node_modules\.bin\google-closure-compiler --externs äö.js --js_output_file out.js --js a.js
[ '--externs', 'äö.js', '--js_output_file', 'out.js', '--js', 'a.js' ]
ERROR - [JSC_READ_ERROR] Cannot read file äö.js: äö.js
1 error(s), 0 warning(s)
C:\☃em sd äö Ć € 🦠\emsdk\emscripten\main> node_modules\.bin\google-closure-compiler --externs a.js --js_output_file out.js --js äö.js
[ '--externs', 'a.js', '--js_output_file', 'out.js', '--js', 'äö.js' ]
ERROR - [JSC_READ_ERROR] Cannot read file äö.js: äö.js
1 error(s), 0 warning(s)
- Pass UTF-8 chars as output file :
C:\☃em sd äö Ć € 🦠\emsdk\emscripten\main> node_modules\.bin\google-closure-compiler --js a.js --js_output_file äää.js
[ '--js', 'a.js', '--js_output_file', 'äää.js' ]
C:\☃em sd äö Ć € 🦠\emsdk\emscripten\main> dir *.js
Volume in drive C has no label.
Volume Serial Number is 8847-8E7D
Directory of C:\☃em sd äö Ć € 🦠\emsdk\emscripten\main
03/16/2021 06:18 PM 3,472 a.js
03/16/2021 06:24 PM 5,595 äää.js
2 File(s) 9,067 bytes
0 Dir(s) 1,757,393,338,368 bytes free
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Warn when producing invalid UTF-8 output files #1704 - GitHub
When running the compiler with --charset UTF-8 one can potentially end up with not strictly valid output files. The problem is that ...
Read more >closurebuilder.py error on Windows: "can't decode byte 0x8f"
This error complaining about a UnicodeDecodeError with byte 0x8f occurs whether I'm trying to build a simple script, a blank file, or something...
Read more >How can we provide charset while compiling the code
Hi.. I am trying to use compiler to minify JS code which has some chinese characters. The encoding of the file is utf-16....
Read more >CoffeeScript
CoffeeScript can compile if statements into JavaScript expressions, using the ternary operator when possible, and closure wrapping otherwise. There is no ...
Read more >Python Files and os.path - 2021 - BogoToBogo
Note that when we called the os.chdir() function, we used a Linux-style pathname (forward slashes, no drive letter) even though we're on Windows....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m afraid we’re just really not motivated to spend development effort on making non-ascii JS inputs work.
However, we’ll be happy to review and merge a PR if someone in the community would like to create one.
Is this related to this error, that I get for a file with a cyrillic filename?
Filename:
наиывпишв.js
And here is my command:
"C:\Users\Chris\.netbeans\minifierbeans\custom-packages\google-closure-compiler.cmd" "--compilation_level" "SIMPLE" "--language_in" "STABLE" "--language_out" "ECMASCRIPT_NEXT" "--js" "C:/Users/Chris/Documents/NetBeansProjects/HTML5Application/public_html/наиывпишв.js" "--js_output_file" "C:/Users/Chris/Documents/NetBeansProjects/HTML5Application/public_html/наиывпишв.min.js"
And here is the error:
Happens in my NetBeans plugin https://github.com/Chris2011/minifierbeans/issues/90