Skip to content

Conversation

@gucovip
Copy link
Contributor

@gucovip gucovip commented Aug 9, 2023

close #8939

@Justineo
Copy link
Member

Justineo commented Aug 9, 2023

According to the spec, the accurate regexp for identifiers (disregarding unicode escape sequences) should be

/^[$_\p{IDS}][$\p{IDC}\u200c\u200d]*/u

But this may have browser compatibility issues so we may need a simplified version. Where does this \xA0-\uFFFF come from in your change?

@gucovip
Copy link
Contributor Author

gucovip commented Aug 9, 2023

According to the spec, the accurate regexp for identifiers (disregarding unicode escape sequences) should be

/^[$_\p{IDS}][$\p{IDC}\u200c\u200d]*/u

But this may have browser compatibility issues so we may need a simplified version. Where does this \xA0-\uFFFF come from in your change?

reference code const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/ (line: 74)

@sxzz sxzz added the ready to merge The PR is ready to be merged. label Aug 9, 2023
@skirtles-code
Copy link
Contributor

Would it be worth adding some tests for this? I can easily imagine somebody trying to tweak that RegExp in future and accidentally breaking support for Chinese characters.

@skirtles-code
Copy link
Contributor

Seems similar to #6765.

@gucovip gucovip closed this Nov 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready to merge The PR is ready to be merged.

Projects

Status: Rejected

Development

Successfully merging this pull request may close these issues.

Template cannot correctly handle Chinese variable names(中文变量名)

4 participants