-
Notifications
You must be signed in to change notification settings - Fork 341
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
web-ext build/run command does not work with manifest.json in utf-8 with BOM encoding #1013
Comments
I dug into the source code, looks like when the parse-json library processes a utf8 encoded json, it adds a question mark at the very beginning of the json string. |
Hi. Sorry about that. Rather than a problem with the encoding, it sounds like |
Hi. I think I was wrong about web-ext can't work with utf8 encoding. It should be that web-ext can't work with utf8 with BOM encoding. I have edited the issue for it. My manifest.json is here. It does contain some BOM characters but there's no BOM at the beginning. I think the problem is more generic with all the manifest files in utf8 with BOM encoding. I also tried web-ext with a couple add-on examples from https://github.com/mdn/webextensions-examples by saving their manifest files as utf8 with BOM, then web-ext returned the same error as in the issue. |
This is because according to the JSON specification, the BOM is an illegal character, so this is correct behaviour. |
Yes but using a BOM is common on Windows so we should support it. |
FWIW, the spec clearly says about BOM.
|
Test case with BOM the manifest.json file from: https://bugzilla.mozilla.org/show_bug.cgi?id=1583159#c2 The extension loads well in Firefox (when extracted and repackaged as an XPI file), so |
Is this a feature request or a bug?
bug
What is the current behavior?
When running the command "web-ext build" or "web-ext run" in an extension folder where the manifest.json file has the encoding of utf-8 with BOM, it returns an error saying
InvalidManifest: Error parsing manifest.json at manifest.json: JSONError: Unexpected token '?' at 1:1 in manifest.json
?{
^
( I have omitted the absolute paths in the error message)
The commands work as normal when the manifest.json has ANSI encoding.
What is the expected or desired behavior?
I think "web-ext build" and "web-ext run" should work as normal when the manifest.json is in utf-8 with BOM encoding.
Version information (for bug reports)
v8.2.1
5.3.0
master-19bdd384191dbeb51b7376feb3ce47e01347977e
The text was updated successfully, but these errors were encountered: