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

Escape non-ascii characters? #6

Open
Conduitry opened this issue Mar 27, 2018 · 1 comment
Open

Escape non-ascii characters? #6

Conduitry opened this issue Mar 27, 2018 · 1 comment

Comments

@Conduitry
Copy link
Contributor

Ref: sveltejs/v2.svelte.dev#236

This might be something that would be nice. It would have avoided the above issue. If the goal is to produce javascript to re-create the same object, it'd be cool if that javascript were resilient to charset issues.

@Conduitry Conduitry changed the title Escape non-ascii character? Escape non-ascii characters? Mar 27, 2018
@ncoder
Copy link

ncoder commented Mar 9, 2023

I'm encountering a similiar problem in production as well. You get UGC data in your database, then you are playing russian roulette.

JSON.parse(devalue.stringify(decoder.write(Buffer.from([0x11]))))
Uncaught SyntaxError: Unexpected token  in JSON at position 2

//compared with
JSON.parse(JSON.stringify(decoder.write(Buffer.from([0x11]))))
'\x11'

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