readline: add unicodeLineSeparators option to interface - #66478
Open
FrancescoCastaldi wants to merge 20 commits into
Open
FrancescoCastaldi wants to merge 20 commits into
FrancescoCastaldi wants to merge 20 commits into
Conversation
Collaborator
|
Review requested:
|
Contributor
|
Welcome to Node.js, and thank you for your first contribution! Before review, please take a moment to read:
Please make sure every commit is signed off. For a first pull request, GitHub Actions require collaborator approval and Jenkins CI must be started by a collaborator or triager, so an initial wait is normal. |
Signed-off-by: Francesco Castaldi <info@francescocastaldi.it>
Signed-off-by: Francesco Castaldi <info@francescocastaldi.it>
…isabled Signed-off-by: Francesco Castaldi <info@francescocastaldi.it>
Signed-off-by: Francesco Castaldi <info@francescocastaldi.it>
Signed-off-by: Francesco Castaldi <info@francescocastaldi.it>
Signed-off-by: Francesco Castaldi <info@francescocastaldi.it>
Signed-off-by: Francesco Castaldi <info@francescocastaldi.it>
Signed-off-by: Francesco Castaldi <info@francescocastaldi.it>
Signed-off-by: Francesco Castaldi <info@francescocastaldi.it>
Signed-off-by: Francesco Castaldi <info@francescocastaldi.it>
Signed-off-by: Francesco Castaldi <info@francescocastaldi.it>
Signed-off-by: Francesco Castaldi <info@francescocastaldi.it>
Signed-off-by: Francesco Castaldi <info@francescocastaldi.it>
Signed-off-by: Francesco Castaldi <info@francescocastaldi.it>
Signed-off-by: Francesco Castaldi <info@francescocastaldi.it>
Signed-off-by: Francesco Castaldi <info@francescocastaldi.it>
Signed-off-by: Francesco Castaldi <info@francescocastaldi.it>
Signed-off-by: Francesco Castaldi <info@francescocastaldi.it>
Signed-off-by: Francesco Castaldi <info@francescocastaldi.it>
Fixes: nodejs#60606 Signed-off-by: Francesco Castaldi <info@francescocastaldi.it>
FrancescoCastaldi
force-pushed
the
readline-unicode-line-separators-opt-out
branch
from
October 3, 2026 10:55
662a77a to
d5483ab
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #66478 +/- ##
==========================================
+ Coverage 90.42% 90.44% +0.01%
==========================================
Files 790 790
Lines 275435 275450 +15
Branches 52826 52830 +4
==========================================
+ Hits 249070 249117 +47
+ Misses 16765 16727 -38
- Partials 9600 9606 +6
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds an opt-out option
unicodeLineSeparators(defaulting totrue) toreadline.createInterface()andreadlinePromises.createInterface().Rationale
In Node.js 24.0.0 (via PR #57591 / issue #22448), Unicode line separator (
\u2028) and paragraph separator (\u2029) were added as line terminators inreadline. While this adheres to the Unicode standard for general text processing, it causes regressions when parsing JSON Lines (JSONL) data containing\u2028or\u2029inside valid JSON string literals. Since JSON allows raw\u2028and\u2029in strings, splitting on these characters breaks valid JSON records across multiple lines, causingJSON.parse()to fail with syntax errors (as reported in #60606).Providing
unicodeLineSeparators: falseallows callers (such as JSONL parsers, data pipelines, and streaming serializers) to restrict line splitting exclusively to standard ASCII newlines (\r\n,\n,\r) while preserving full backward compatibility by keepingtrueas the default.Key Changes
unicodeLineSeparatorsoption toreadline.createInterface()andreadlinePromises.createInterface().validateBoolean(ERR_INVALID_ARG_TYPE).\u2028/\u2029search inonStreamDataand_ttyWritebehindthis.unicodeLineSeparators.lineEndingWithUnicodeandlineEndingWithoutUnicode) to preserve performance.benchmark/readline/readline-stream-split.js.doc/api/readline.md.Fixes: #60606
Checklist:
testpasses