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

Zero width space characters break NativeMethods.txt #608

Closed
elachlan opened this issue Jul 20, 2022 · 0 comments · Fixed by #609
Closed

Zero width space characters break NativeMethods.txt #608

elachlan opened this issue Jul 20, 2022 · 0 comments · Fixed by #609
Labels
bug Something isn't working

Comments

@elachlan
Copy link
Contributor

elachlan commented Jul 20, 2022

Actual behavior

When a line contains a zero width space character it breaks the build.

Expected behavior

Zero width space characters should be ignored/removed when processing.

Repro steps

  1. NativeMethods.txt content:
ActivateKeyboardLayout
BitBlt

String.Trim doesn't remove zero width space characters:
https://docs.microsoft.com/en-us/dotnet/api/system.string.trim?view=net-6.0

The .NET Framework 3.5 SP1 and earlier versions maintain an internal list of white-space characters that this method trims. Starting with the .NET Framework 4, the method trims all Unicode white-space characters (that is, characters that produce a true return value when they are passed to the IsWhiteSpace(Char) method). Because of this change, the Trim() method in the .NET Framework 3.5 SP1 and earlier versions removes two characters, ZERO WIDTH SPACE (U+200B) and ZERO WIDTH NO-BREAK SPACE (U+FEFF), that the Trim() method in the .NET Framework 4and later versions does not remove. In addition, the Trim() method in the .NET Framework 3.5 SP1 and earlier versions does not trim three Unicode white-space characters: MONGOLIAN VOWEL SEPARATOR (U+180E), NARROW NO-BREAK SPACE (U+202F), and MEDIUM MATHEMATICAL SPACE (U+205F).

@elachlan elachlan added the bug Something isn't working label Jul 20, 2022
elachlan added a commit to elachlan/CsWin32 that referenced this issue Jul 20, 2022
AArnott pushed a commit that referenced this issue Jul 21, 2022
* Fixes #608

* Add char description comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant