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

readline: processing \u2028 and \u2029 #22448

Open
vsemozhetbyt opened this issue Aug 21, 2018 · 3 comments
Open

readline: processing \u2028 and \u2029 #22448

vsemozhetbyt opened this issue Aug 21, 2018 · 3 comments
Labels
help wanted Issues that need assistance from volunteers or PRs that need help to proceed. readline Issues and PRs related to the built-in readline module.

Comments

@vsemozhetbyt
Copy link
Contributor

Not sure if we should fix, document, or ignore this and if it has been discussed, so to be on the safe side.

Currently, \u2028 and \u2029 are considered as line breaks by JavaScript RegExps, while they are ignored by the readline:

'use strict';

const fs = require('fs');
const readline = require('readline');

const str = '123\n456\r123\u{2028}456\u{2029}789';

console.log(str.split(/^/mu));

fs.writeFileSync('readline-test.txt', str, 'utf8');

const rl = readline.createInterface({
  input: fs.createReadStream('readline-test.txt', 'utf8'),
  crlfDelay: Infinity,
});

rl.on('line', console.log);

out

Feel free to close if this is a wontfix.

@vsemozhetbyt vsemozhetbyt added the readline Issues and PRs related to the built-in readline module. label Aug 21, 2018
@addaleax
Copy link
Member

I think consistency with JS RegExps is a good argument to do this.

@apapirovski
Copy link
Member

I agree with changing this for consistency.

@BridgeAR
Copy link
Member

If we want to support this, should it also be an opt-in as is for regular expressions?

@jasnell jasnell added the help wanted Issues that need assistance from volunteers or PRs that need help to proceed. label Jun 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Issues that need assistance from volunteers or PRs that need help to proceed. readline Issues and PRs related to the built-in readline module.
Projects
None yet
Development

No branches or pull requests

6 participants
@apapirovski @jasnell @addaleax @BridgeAR @vsemozhetbyt and others