please respect unicode strings you are given
See original GitHub issueesprima.parse('a = "привет"')
clearly preserves unicode strings in the format supplied
{ type: 'Program',
body:
[ { type: 'ExpressionStatement',
expression:
{ type: 'AssignmentExpression',
operator: '=',
left: { type: 'Identifier', name: 'a' },
right: { type: 'Literal', value: 'привет', raw: '"привет"' } } } ] }
esgen(esprima.parse('a = "привет"'))
clearly does not
a = '\u043F\u0440\u0438\u0432\u0435\u0442';
Technically these js-strings are equivalent, but why forego readability?
Issue Analytics
- State:
- Created 8 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
How to solve unicode encoding issues - Invivoo
In ths new article, our expert will explain you how to solve unicode encoding issues. If you have any question, don't hesite to...
Read more >python3 pySerial TypeError: unicode strings are not supported ...
Encode your data which you are writing to serial,in your case "serialcmd" to bytes.try the following : ser.write(serialcmd.encode()).
Read more >Unicode strings - Rosetta Code
For handling multiple languages, Unicode is your best friend. Task. Unicode strings. You are encouraged to solve this task according to the task ......
Read more >UAX #15: Unicode Normalization Forms
This annex describes normalization forms for Unicode text. When implementations keep strings in a normalized form, they can be assured that equivalent ...
Read more >Typing Unicode string - NI Community - National Instruments
Hi All, I am trying to type Unicode strings in LabVIEW 2015. ... Similarly, if you are given a Unicode String, you can...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@vkz
We can’t have
"
in"
-delimited strings. We can’t have a carriage return or a paragraph separator. To avoid these characters, we can just Unicode escape everything. It’s the same string. If you really want to avoid Unicode escapes, use{format: {escapeless: true}}
as your escodegen options. But the only way to use the same escapes that you used in your original code is to use the{verbatim: "raw"}
option.every time uglify-js does this horribly unsafe thing a puppy dies.
Having lost several hours of my life debugging this safe behaviour I feel some friendly trolling is warranted here. There’ll be many a poor sobs down the road tripping over this, I’m sure.
NB: Esprima and Escodegen have saved me countless hours, I use them daily and I am absolutely grateful to their authors and maintainers for keeping them open source and providing support.