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

Change unit definition JSON from UTF-8-BOM to UTF-8 #730

Merged
merged 93 commits into from
Dec 29, 2019
Merged

Change unit definition JSON from UTF-8-BOM to UTF-8 #730

merged 93 commits into from
Dec 29, 2019

Conversation

haimkastner
Copy link
Contributor

When I developed a similar generated library for JavaScript (called unitsnet-js) from those units definition files, the JavaScript JSON parser failed because most of the schemas start with an unknown character.

The unknown character is shown only in the live web version, when I used git to clone the repo, the character has gone (Tested on Windows 10 OS). this why the fix is separated into each file one commit.

This is how it's look in the GitHub web version:
image

Otherways the js JSON parse method returns `SyntaxError: Unexpected token  in JSON at position 0` error.
Otherways the js JSON parse method returns `SyntaxError: Unexpected token  in JSON at position 0` error.
Otherways the js JSON parse method returns `SyntaxError: Unexpected token  in JSON at position 0` error.
Otherways the js JSON parse method returns `SyntaxError: Unexpected token  in JSON at position 0` error.
Otherways the js JSON parse method returns `SyntaxError: Unexpected token  in JSON at position 0` error.
Otherways the js JSON parse method returns `SyntaxError: Unexpected token  in JSON at position 0` error.
Otherways the js JSON parse method returns `SyntaxError: Unexpected token  in JSON at position 0` error.
Otherways the js JSON parse method returns `SyntaxError: Unexpected token  in JSON at position 0` error.
Otherways the js JSON parse method returns `SyntaxError: Unexpected token  in JSON at position 0` error.
Otherways the js JSON parse method returns `SyntaxError: Unexpected token  in JSON at position 0` error.
Otherways the js JSON parse method returns `SyntaxError: Unexpected token  in JSON at position 0` error.
Otherways the js JSON parse method returns `SyntaxError: Unexpected token  in JSON at position 0` error.
Otherways the js JSON parse method returns `SyntaxError: Unexpected token  in JSON at position 0` error.
Otherways the js JSON parse method returns `SyntaxError: Unexpected token  in JSON at position 0` error.
Otherways the js JSON parse method returns `SyntaxError: Unexpected token  in JSON at position 0` error.
Otherways the js JSON parse method returns `SyntaxError: Unexpected token  in JSON at position 0` error.
Otherways the js JSON parse method returns `SyntaxError: Unexpected token  in JSON at position 0` error.
Otherways the js JSON parse method returns `SyntaxError: Unexpected token  in JSON at position 0` error.
Otherways the js JSON parse method returns `SyntaxError: Unexpected token  in JSON at position 0` error.
Otherways the js JSON parse method returns `SyntaxError: Unexpected token  in JSON at position 0` error.
Otherways the js JSON parse method returns `SyntaxError: Unexpected token  in JSON at position 0` error.
Otherways the js JSON parse method returns `SyntaxError: Unexpected token  in JSON at position 0` error.
Otherways the js JSON parse method returns `SyntaxError: Unexpected token  in JSON at position 0` error.
Otherways the js JSON parse method returns `SyntaxError: Unexpected token  in JSON at position 0` error.
Otherways the js JSON parse method returns `SyntaxError: Unexpected token  in JSON at position 0` error.
Otherways the js JSON parse method returns `SyntaxError: Unexpected token  in JSON at position 0` error.
Otherways the js JSON parse method returns `SyntaxError: Unexpected token  in JSON at position 0` error.
Otherways the js JSON parse method returns `SyntaxError: Unexpected token  in JSON at position 0` error.
Otherways the js JSON parse method returns `SyntaxError: Unexpected token  in JSON at position 0` error.
Otherways the js JSON parse method returns `SyntaxError: Unexpected token  in JSON at position 0` error.
Otherways the js JSON parse method returns `SyntaxError: Unexpected token  in JSON at position 0` error.
Otherways the js JSON parse method returns `SyntaxError: Unexpected token  in JSON at position 0` error.
Otherways the js JSON parse method returns `SyntaxError: Unexpected token  in JSON at position 0` error.
Otherways the js JSON parse method returns `SyntaxError: Unexpected token  in JSON at position 0` error.
Otherways the js JSON parse method returns `SyntaxError: Unexpected token  in JSON at position 0` error.
Otherways the js JSON parse method returns `SyntaxError: Unexpected token  in JSON at position 0` error.
Otherways the js JSON parse method returns `SyntaxError: Unexpected token  in JSON at position 0` error.
Otherways the js JSON parse method returns `SyntaxError: Unexpected token  in JSON at position 0` error.
Otherways the js JSON parse method returns `SyntaxError: Unexpected token  in JSON at position 0` error.
Otherways the js JSON parse method returns `SyntaxError: Unexpected token  in JSON at position 0` error.
Otherways the js JSON parse method returns `SyntaxError: Unexpected token  in JSON at position 0` error.
Otherways the js JSON parse method returns `SyntaxError: Unexpected token  in JSON at position 0` error.
Otherways the js JSON parse method returns `SyntaxError: Unexpected token  in JSON at position 0` error.
Otherways the js JSON parse method returns `SyntaxError: Unexpected token  in JSON at position 0` error.
Otherways the js JSON parse method returns `SyntaxError: Unexpected token  in JSON at position 0` error.
Otherways the js JSON parse method returns `SyntaxError: Unexpected token  in JSON at position 0` error.
Otherways the js JSON parse method returns `SyntaxError: Unexpected token  in JSON at position 0` error.
Otherways the js JSON parse method returns `SyntaxError: Unexpected token  in JSON at position 0` error.
SyntaxError: Unexpected token ] in JSON at position 2871
@codecov-io
Copy link

Codecov Report

Merging #730 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #730   +/-   ##
=======================================
  Coverage   58.56%   58.56%           
=======================================
  Files         171      171           
  Lines       38430    38430           
=======================================
  Hits        22507    22507           
  Misses      15923    15923

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f04db7d...1c26709. Read the comment docs.

@angularsen
Copy link
Owner

This is probably the UTF-8 BOM characters you are seeing. I believe it causes problems on the web, where UTF-8 files are expected to not include the BOM character. I'll try your change and if it doesn't break anything, I think we can merge it in. Will get back to you.

@angularsen
Copy link
Owner

Regenerating code locally does not seem to do any changes except a couple of innocent whitespace changes, so this change should be safe 👍 Famous last words!

@angularsen
Copy link
Owner

Confirmed files are now encoded with utf-8 and not utf-8-bom.

@angularsen angularsen changed the title Fix units definitions schemas Change unit definition JSON from UTF-8-BOM to UTF-8 Dec 29, 2019
@angularsen angularsen merged commit fe6bd2a into angularsen:master Dec 29, 2019
@angularsen
Copy link
Owner

Thanks! Also, I dig that you made a javascript equivalent. We had an issue #410 on this before, but I never had the time or incentive to put the time into something like that. Very nice!

haimkastner added a commit to haimkastner/unitsnet-js that referenced this pull request Dec 30, 2019
haimkastner added a commit to haimkastner/unitsnet-js that referenced this pull request Dec 30, 2019
* Remove local units definitions #2

* Fetch units definitions from the original angularsen unitsnet repo
angularsen/UnitsNet#730 #2
@haimkastner haimkastner mentioned this pull request Mar 29, 2020
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

Successfully merging this pull request may close these issues.

3 participants