-
-
Notifications
You must be signed in to change notification settings - Fork 158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Minification inadvertently converts ISO-8859-1 non-ASCII characters to UTF-8 #107
Comments
hm, looks like a terser bug, can you try compress file without webpack plugin and check all fine or not? |
Would you mind elaborating on how I would do that? I'm not too deep into WebPack at this time, I'm afraid. |
@SetTrend install |
I just did as you suggested and ran the proposed test. It looks like Running ... npx tsc results in these four files: With (Which is fine until that point.) Then running ... npx terser "dist/*.js" -c -m -o "dist2/test.js" results in this file: With (Which is wrong. The What would you suggest on how to proceed? |
@SetTrend i can't understand, bug exists in terser? Why do you use |
That's not the case. Let me iterate:
What Terser does: It actually interprets the literal strings' encoding, concludes from the control character within the string literals that the string literals must be No matter what character points a string literal contains, Terser is supposed to render it 1:1, unchanged. |
@SetTrend i think better open issue in |
agree that it is an issue in terser. |
After the issue has been confirmed by one of the Terser contributors, he offered a workaround: The Trying to add that I noticed that the Terser |
You can set any custom options for terser using https://github.com/webpack-contrib/terser-webpack-plugin#terseroptions |
|
Expected Behavior
Minifying string literals in a UTF-8 Javascript file should not alter the text's non-ASCII characters.
Actual Behavior
Non-ASCII characters in a string literal from a UTF-8 JavaScript file are inadvertently converted to their UTF-8 counterparts.
Code
See this sample repository.
How Do We Reproduce?
See above.
The text was updated successfully, but these errors were encountered: