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

The Chinese & are forced to \uFF08 & \uFF09, how to keep them? #386

Open
finscn opened this issue Nov 17, 2018 · 2 comments
Open

Comments

@finscn
Copy link

finscn commented Nov 17, 2018

There are some Chinese chars in my code , example :

var name = "大城小胖(fins)";

I use escodegen.generate to re-generate my code , the string become :

var name = '大城小胖\uFF08fins\uFF09';

How to keep them ?

And I've test , it's not esprima.parse's fault.
the string in the AST is original.

version:
"escodegen": "^1.11.0",
"esprima": "^4.0.1",


I found (is not , ) is also with this bug.

@finscn
Copy link
Author

finscn commented Nov 17, 2018

I found it's esutils's bug.
It's too old (the last update at 4 years ago)

esutils.code.isIdentifierPartES5 can't work correctly when parse & .

esutils.code.isIdentifierPartES5("大")  ---> true  , it's right
esutils.code.isIdentifierPartES5("(")  ---> false  ,  it's wrong  

, not ( , It's not ascii.

I think escodegen should find a new tool.

@finscn
Copy link
Author

finscn commented Nov 17, 2018

And I found 2 esutils projects at npmjs :

npm i esutils
npm i @gerhobbelt/esutils

I've create a PR to @gerhobbelt/esutils . (wrong PR)

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

1 participant