Skip to content

Keep fast-parser unquoting consistent at Unicode line boundaries - #1073

Merged
motdotla merged 1 commit into
motdotla:masterfrom
xiehuanyi:fix/unicode-unquoting-parity
Oct 14, 2026
Merged

motdotla merged 1 commit into
motdotla:masterfrom
xiehuanyi:fix/unicode-unquoting-parity

Conversation

@xiehuanyi

Copy link
Copy Markdown
Contributor

parse() and parse(..., { fast: true }) disagree on an unquoted value containing a Unicode line separator followed by a quoted segment. For example, with A=prefix\u2028"" (an actual U+2028 character), the classic parser returns prefix followed by the separator, while fast mode retains the quotes. The classic unquoting expression uses multiline anchors, which also apply at U+2028 and U+2029 inside an otherwise unquoted value.

Apply those existing unquoting rules in the fast parser's Unicode-separator fallback. Retain the direct handling for ordinary values. Add string/Buffer cases for both separators and all three quote styles, with surrounding assignments and quoted/unterminated controls.

Validation: the new parity assertion fails on unchanged master; an independent 60-case matrix has 36 mismatches before and none after. npm test passes 1315 assertions with one existing skip, including build, Standard lint and declaration checks. The performance gate passes at 1.94x for Buffers and 1.92x for strings (minimum 1.5x). git diff --check passes. Tested on Node 22.23.1/Linux; Windows and other CI Node versions were not exercised. This clean-master branch excludes PR #1072.

AI disclosure: OpenAI Codex assisted with investigation, implementation, regression tests, and this description.

AI-assisted implementation and verification using OpenAI Codex.
Copilot AI balanced review requested due to automatic review settings October 10, 2026 18:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@motdotla

Copy link
Copy Markdown
Owner

nice catch!

@motdotla
motdotla merged commit 55855ab into motdotla:master Oct 14, 2026
8 checks passed
renovate Bot added a commit to andrei-picus-tink/auto-renovate that referenced this pull request Oct 17, 2026
| datasource | package | from   | to     |
| ---------- | ------- | ------ | ------ |
| npm        | dotenv  | 18.0.7 | 18.0.8 |


## [v18.0.8](https://github.com/motdotla/dotenv/blob/HEAD/CHANGELOG.md#1808-2026-10-14)

##### Changed

- Fast parser should strip appended extra quotes ([#1073](motdotla/dotenv#1073))
- Type detail improvement ([#1074](motdotla/dotenv#1074))
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.

3 participants