Skip to content
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

Remove BOM characters from JSON file before parsing #20

Closed
mmukarram opened this issue Dec 15, 2015 · 1 comment
Closed

Remove BOM characters from JSON file before parsing #20

mmukarram opened this issue Dec 15, 2015 · 1 comment

Comments

@mmukarram
Copy link
Contributor

With the most recent version bump from 0.3.1 to 0.3.2, the dependency migration for the parser from jsonlint to json-parse-helpfulerror breaks when processing JSON files that have Byte-order Mark characters. Since the JSON files are already being loaded with UTF-8 encoding, it would make sense to remove these characters.

Planning on modifying the following lines (and tests) and sending a pull request :

    data = fs.readFileSync(path, 'utf-8');

   // data = data.replace(/\UFEFF/g, '');

    if (options.replace) {
        data = exports.replace(data, options.replace);
    }
@kof
Copy link
Owner

kof commented Dec 15, 2015

thanks, will accept a PR

mmukarram pushed a commit to mmukarram/node-cjson that referenced this issue Jan 13, 2016
mmukarram pushed a commit to mmukarram/node-cjson that referenced this issue Jan 13, 2016
mmukarram pushed a commit to mmukarram/node-cjson that referenced this issue Jan 13, 2016
mmukarram added a commit to mmukarram/node-cjson that referenced this issue Jan 13, 2016
kof added a commit that referenced this issue Jan 13, 2016
Issue #20: Fix parsing JSON files with BOM characters
@kof kof closed this as completed May 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants