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

Non-breaking spaces not working correctly #102

Open
evilpixi opened this issue Aug 7, 2020 · 3 comments
Open

Non-breaking spaces not working correctly #102

evilpixi opened this issue Aug 7, 2020 · 3 comments

Comments

@evilpixi
Copy link

evilpixi commented Aug 7, 2020

https://imgur.com/xGH9jZC

A coworker using sublime text uses &nbsp characters for spaces.
If I remove the &nbsp characters it works fine.
Shouldn't it work anyways?

@dqsully
Copy link
Member

dqsully commented Aug 8, 2020

No. The only "whitespace" characters in Hjson are space (0x20), tab (0x09), new line/line feed (0x0A) and carriage return (0x0D). When you use the non-breaking space character Hjson will treat it like text.

@evilpixi
Copy link
Author

why? is this a design decision?

@sffc
Copy link

sffc commented Aug 12, 2020

&nbsp (U+00A0) is not normally treated as an ignorable whitespace character; that's why it exists as a separate code point from U+0020. You can find a list of characters that Unicode considers ignorable in pattern syntax here:

http://unicode.org/L2/L2005/05012r-pattern.html

Unicode recommends effectively 9 ignorable characters:

0009..000D     # Cc   [5] <control-0009>..<control-000D>
0020           # Zs       SPACE
0085           # Cc       <control-0085>
200E..200F     # Cf   [2] LEFT-TO-RIGHT MARK..RIGHT-TO-LEFT MARK
2028           # Zl       LINE SEPARATOR
2029           # Zp       PARAGRAPH SEPARATOR

I think @dqsully's list of ASCII-range whitespace characters in common use is a reasonable set.

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

3 participants