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
When bundling files encoded as UTF-8 with a byte order marker, BOMs are retained #313
Comments
👍 |
utf-8 is hard. can you provide a file with such a marker, or a script to add one to a file? |
This is the code I've used to remove it in the past: function stripBOM(str){
return 0xFEFF == str.charCodeAt(0)
? str.substring(1)
: str;
} This should add one: function addBOM(str){
return '\ufeff' + stripBOM(str);
} |
Fixed in 3.11.1 with a test too. |
ghost
closed this as completed
Dec 20, 2013
npmcomponent
pushed a commit
to npmcomponent/marcelklehr-changesets
that referenced
this issue
Jan 6, 2014
Browsers dislike \ufeff showing up in the middle of a script, which happens when we bundle with browserify. So we remove all BOMs in this project. Related: browserify/browserify#313
This issue was closed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Some UTF-8 encoded files include a byte order marker at the beginning. These are retained when bundling causing a SyntaxError: illegal character error when the script is executed.
Although you're not using fs.readFileSync it's a similar issue to nodejs/node-v0.x-archive#1918
The text was updated successfully, but these errors were encountered: