Skip to content

Skip Unicode escape for characters supported by the file's charset#1518

Merged
ptziegler merged 1 commit into
eclipse-windowbuilder:masterfrom
marcmuel:escape-strings-respecting-charset
May 19, 2026
Merged

Skip Unicode escape for characters supported by the file's charset#1518
ptziegler merged 1 commit into
eclipse-windowbuilder:masterfrom
marcmuel:escape-strings-respecting-charset

Conversation

@marcmuel
Copy link
Copy Markdown
Contributor

StringConverter forced a Unicode escape (\uXXXX form) for every non-ASCII character whenever the source file was not UTF-8 / UTF-16. For sources saved in windows-1252, ISO-8859-1, etc. this meant German umlauts became e.g. \u00DC even though the file charset can represent them natively, harming readability.

Generalize the existing UTF-8 / UTF-16 fast-path to a charset-aware one: ask the file's charset whether each character can be encoded, only escape what it cannot.

StringConverter forced a Unicode escape (\uXXXX form) for every
non-ASCII character whenever the source file was not UTF-8 / UTF-16.
For sources saved in windows-1252, ISO-8859-1, etc. this meant German
umlauts became e.g. \u00DC even though the file charset can represent
them natively, harming readability.

Generalize the existing UTF-8 / UTF-16 fast-path to a charset-aware
one: ask the file's charset whether each character can be encoded,
only escape what it cannot.
@github-actions
Copy link
Copy Markdown

Test Results

 2 720 files  ±0   2 720 suites  ±0   10h 20m 11s ⏱️ - 30m 13s
 7 018 tests ±0   6 988 ✅ ±0   30 💤 ±0  0 ❌ ±0 
28 072 runs  ±0  27 940 ✅ ±0  132 💤 ±0  0 ❌ ±0 

Results for commit de16dd8. ± Comparison against base commit a85c76f.

@ptziegler ptziegler added this to the 1.24.0 milestone May 19, 2026
Copy link
Copy Markdown
Contributor

@ptziegler ptziegler left a comment

Choose a reason for hiding this comment

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

Makes sense. Thanks!

@ptziegler ptziegler merged commit 73f5834 into eclipse-windowbuilder:master May 19, 2026
8 checks passed
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