Skip to content

Don't trim non-ASCII whitespace#289

Merged
jgm merged 1 commit intocommonmark:masterfrom
tats-u:trim-only-ascii-space
Sep 23, 2024
Merged

Don't trim non-ASCII whitespace#289
jgm merged 1 commit intocommonmark:masterfrom
tats-u:trim-only-ascii-space

Conversation

@tats-u
Copy link
Copy Markdown
Contributor

@tats-u tats-u commented Sep 8, 2024

Fixes #261

.trim() removes non-ascii Unicode white spaces as well.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/trim

PS D:\cmark\out\install\x64-Debug\bin> .\cmark.exe
 全角スペース (U+3000) 全形空白 

 Em Space (U+2003) Em Space 

 NBSP (U+00A0) NBSP
^Z
<p> 全角スペース (U+3000) 全形空白 </p>
<p>?Em Space (U+2003) Em Space?</p>
<p>NBSP (U+00A0) NBSP</p>

cmark removes NBSP, but is this an expected behavior?
(? means U+2003 can't be converted to Shift_JIS, which is the OEM encoding in Japanese Windows.)

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.

U+3000 ( ) is allowed as paragraph indentation

2 participants