Skip to content

Fix bugs related to unicode identifiers python - #2484

Open
GanerCodes wants to merge 1 commit into
beautifier:mainfrom
GanerCodes:fix-python-unicode-identifier
Open

Fix bugs related to unicode identifiers python#2484
GanerCodes wants to merge 1 commit into
beautifier:mainfrom
GanerCodes:fix-python-unicode-identifier

Conversation

@GanerCodes

@GanerCodes GanerCodes commented Jun 23, 2026

Copy link
Copy Markdown

Description

  • Source branch in your fork has meaningful name (not main)

Fixes Issue: #2411

Before Merge Checklist

These items can be completed after PR is created.

(Check any items that are not applicable (NA) for this PR)

  • JavaScript implementation
  • Python implementation (NA if HTML beautifier)
  • Added Tests to data file(s)
  • Added command-line option(s) (NA if
  • README.md documents new feature/option(s)

@GanerCodes GanerCodes changed the title Fix bugs related to unicode identification python Fix bugs related to unicode identifiers python Jun 23, 2026
try:
re = __import__("regex")
except ImportError:
import re

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please explain further.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://pypi.org/project/regex/ allows us to just use the character classes of ECMAScript identifiers directly.

_nonASCIIidentifierStartChars = r"\p{L}\p{Nl}"
_nonASCIIidentifierChars = r"\p{L}\p{Nl}\p{Nd}\p{Pc}\p{Mn}\p{Mc}"

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

Successfully merging this pull request may close these issues.

2 participants