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

Verify UTF-8 encoding #3

Open
jansorg opened this issue Feb 22, 2021 · 2 comments
Open

Verify UTF-8 encoding #3

jansorg opened this issue Feb 22, 2021 · 2 comments
Labels
CUE Specification Related to CUE's official language specification

Comments

@jansorg
Copy link
Collaborator

jansorg commented Feb 22, 2021

https://github.com/cuelang/cue/blob/master/doc/ref/spec.md#source-code-representation

UTF-8 seems to be the only valid encoding. We could:

  • enforce UTF-8 where possible
  • add an inspection to warn for incorrectly encoded .cue files
@jansorg jansorg added the CUE Specification Related to CUE's official language specification label Feb 22, 2021
@leoluk
Copy link
Member

leoluk commented Feb 22, 2021

The scanner seems to be quite forgiving:

https://github.com/cuelang/cue/blob/d9d048725a6d2e69c16533ddf87be7368f199740/cue/scanner/scanner.go#L81

Even clearly invalid Unicode is parsed and survives the round-trip through cue eval:

echo -ne 'foo: "\xf0\x28\x8c\x28\x7F\xfe\xff"' >> imports.cue

Not sure if this is a bug or a feature.

@orpharion
Copy link

I have had issues where UTF-16 json files on windows fail to read.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CUE Specification Related to CUE's official language specification
Projects
None yet
Development

No branches or pull requests

3 participants