Skip to content

Preserve U+FEFF in quoted filenames - #728

Open
Don-Yin wants to merge 1 commit into
kpdecker:masterfrom
Don-Yin:preserve-feff-filenames
Open

Don-Yin wants to merge 1 commit into
kpdecker:masterfrom
Don-Yin:preserve-feff-filenames

Conversation

@Don-Yin

@Don-Yin Don-Yin commented Oct 22, 2026

Copy link
Copy Markdown

parsePatch currently treats the start of each octal-escaped byte run as a possible BOM. For a\uFEFFnote.txt, Git writes a\357\273\277note.txt, but the parsed filename becomes anote.txt.

This sets ignoreBOM: true so U+FEFF stays part of the filename. The added test covers leading, embedded, path-component, and consecutive U+FEFF characters, checking oldFileName, newFileName, and index.

I also checked actual git diff output for these four filenames. The plot counts retained U+FEFF characters; labels show the character as \uFEFF.

U+FEFF characters retained in filenames before and after the fix

Tests:

  • yarn run-mocha --grep 'preserve a U': 0 passing / 1 failing before; 1 passing after.
  • yarn test: 327 passing, including lint, both builds, type checks, and coverage gates.

U+FEFF is part of a filename, even when its UTF-8 bytes begin an
octal-escaped run. Tell TextDecoder to retain it instead of treating
it as a BOM.

Signed-off-by: Don Yin <Don_Yin@outlook.com>
@Don-Yin

Don-Yin commented Nov 5, 2026

Copy link
Copy Markdown
Author

Gentle ping on this one whenever you have time. No rush, happy to change anything.

This branch has not been deployed

No deployments
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.

1 participant