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

Windows file formats UTF-8-BOM (CR LF) #14

Closed
cs-NET opened this issue Nov 19, 2019 · 3 comments
Closed

Windows file formats UTF-8-BOM (CR LF) #14

cs-NET opened this issue Nov 19, 2019 · 3 comments

Comments

@cs-NET
Copy link

cs-NET commented Nov 19, 2019

Ran into an issue running json-autotranslate for the second time on Windows platform. It appears that when reading the files from the cache folder an exception will be thrown parsing JSON if the files are not UTF-8 with Unix (LF) EOL. In my case one of the files was UTF-8-BOM with Windows (CR LF) EOL, I assume that the file format is carried over from the original file. (I happen to auto generate one of the json files from a RESX file hence one file was in a windows file format).

To fix the problem I manually converted the JSON files to UTF-8 with Unix (LF) EOL, including those in the cache folder.

Adding a note about Windows compatibility would be sufficient, or even better adding support for windows file formats.

Thanks for the great work!

Version 1.5.2

Unexpected token  in JSON at position 0
SyntaxError: Unexpected token  in JSON at position 0
    at JSON.parse (<anonymous>)
    at D:\repos\project\node_modules\json-autotranslate\lib\index.js:248:91
@leolabs
Copy link
Owner

leolabs commented Nov 27, 2019

Hey, sorry for the late reply. I'll try to fix that issue today. Could you attach a sample JSON file where this error occurs so that I can reproduce the issue on my end? :)

@cs-NET
Copy link
Author

cs-NET commented Nov 27, 2019

I have attached a json file in utf-8-bom with cr lf

windows-utf-8-bom-cr-lf.zip

@leolabs
Copy link
Owner

leolabs commented Dec 25, 2019

This should be fixed in c45a44b :)

@leolabs leolabs closed this as completed Dec 25, 2019
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