Repository navigation
readline: processing \u2028 and \u2029 #22448
Description
Activity
- addedreadlineIssues and PRs related to the built-in readline module.Issues and PRs related to the built-in readline module.
on Aug 21, 2018 I think consistency with JS RegExps is a good argument to do this.
I agree with changing this for consistency.
If we want to support this, should it also be an opt-in as is for regular expressions?
- addedhelp wantedIssues that need assistance from volunteers or PRs that need help to proceed.Issues that need assistance from volunteers or PRs that need help to proceed.
on Jun 26, 2020 Is this issue still relevant? It appears to have been resolved by @dario-piotrowicz in a42bca5
Maybe it would be possible to add a new option to
createInterfacethat allows you to specify a line separator? I'd like to be able to usereadlineto streamjsonlfiles, but are written with\u2028in string values which gets separated and is no longerJSON.parseableHappy to make a PR if this sounds reasonable
Reacted by DavidPlease forgive me for butting in so late in the game, but I have just encountered this for the first time:
I would propose that consistency with regular expressions is not the choice to make here.
As someone who is using readline to parse text files (in this case .jsonl), I see a very sharp distinction between formatting, where the various U+2028, U+2029, RTL/LTR OVERRIDE, etc... characters are relevant, and actual "system line separation" (CR or CRLF (and perhaps some old systems still exist with LF?)) which is IMHO an almost-binary boundary. Adding new newline conventions only adds noise to the already fragmented CR/CRLF/LF situation.
At most, I would add support for splitting on U+2028 and the like as an opt-in, not as the convention. I realize that in the current situation the train has already left the station, so can we please have an opt-out?This issue has been marked as stale due to 90 days of inactivity.
It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.- addedstaleIssues and PRs marked stale due to inactivity and scheduled for automatic closure.Issues and PRs marked stale due to inactivity and scheduled for automatic closure.
on Sep 4, 2026 This issue has been automatically closed after 30 days of inactivity following its stale status (no activity for a total of 120 days).
If this is still relevant, feel free to reopen it or leave a comment with additional details so we can continue the discussion.
![screenshot of running node -e 'console.log("123\n456\r789\u{2028}ABC\u{2029}DEF".split(/^/m));' resulting in [ '123\n', '456\r', '789
', 'ABC
', 'DEF' ]](https://github.com/proxy/private-user-images.githubusercontent.com/61631103/425771798-57f341da-ad1e-4054-ad96-d7c52f98d548.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3OTE2MjIwNjQsIm5iZiI6MTc5MTYyMTc2NCwicGF0aCI6Ii82MTYzMTEwMy80MjU3NzE3OTgtNTdmMzQxZGEtYWQxZS00MDU0LWFkOTYtZDdjNTJmOThkNTQ4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjEwMTAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYxMDEwVDA4NDI0NFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWNkMTZjZjQzMWZjYzlkOTA4OGYxNGI1MzExOTgxMjZiZjI3ZDdjYjg4YTQwNWI0Y2M0MDk1NzVkZDIxYjgyYjcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JnJlc3BvbnNlLWNvbnRlbnQtdHlwZT1pbWFnZSUyRnBuZyJ9.mEfv6e02JzoTzD8m1aPNQQCY36x9pv4AcjxSyUQ2LyU)
Not sure if we should fix, document, or ignore this and if it has been discussed, so to be on the safe side.
Currently,
\u2028and\u2029are considered as line breaks by JavaScriptRegExps, while they are ignored by thereadline:Feel free to close if this is a wontfix.