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

Invalid UTF-8 chars prevent formatting #5

Open
lucacasonato opened this issue Jun 6, 2021 · 2 comments
Open

Invalid UTF-8 chars prevent formatting #5

lucacasonato opened this issue Jun 6, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@lucacasonato
Copy link

Describe the bug

deno fmt fails to format a JSON file because it contains invalid UTF8 chars.

dprint-plugin-json version: 0.10.2

Input Code

See https://gist.github.com/lucacasonato/a060df497ca3156327bcef46a554a8fb

Expected Output

A nicely formatted file, like prettier is able to generate.

Actual Output

Error formatting: /home/lucacasonato/Downloads/report.json
   Line 1, column 785340: Invalid unicode escape sequence. 'd834' is not a valid UTF8 character

  to ArrayBuffer with \ud834A\udf06A¥
                      ~~~~~~
@lucacasonato lucacasonato changed the title Invalid UTF-8 prevent formatting Invalid UTF-8 chars prevent formatting Jun 6, 2021
@dsherret dsherret added the bug Something isn't working label Jun 6, 2021
@dsherret
Copy link
Member

dsherret commented Jun 6, 2021

Related: dprint/jsonc-parser#8

I think we will just have to make jsonc-parser handle invalid utf8 characters.

@Gerrit0
Copy link

Gerrit0 commented Nov 26, 2023

A similar "\uD835\uDD04" can't be handled in typedoc when I looked at using dprint today, what's the path forward in jsonc-parser? I very briefly looked at doing this, but jsonc-parser's StringLit struct holds a Cow<'a, str>, and changing that seems like quite a major change...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants