Skip to content

fix(form-data): preserve leading BOM in multipart text parts#317

Open
watilde wants to merge 1 commit into
bytecodealliance:mainfrom
watilde:fix/form-data-preserve-bom
Open

fix(form-data): preserve leading BOM in multipart text parts#317
watilde wants to merge 1 commit into
bytecodealliance:mainfrom
watilde:fix/form-data-preserve-bom

Conversation

@watilde

@watilde watilde commented Jun 27, 2026

Copy link
Copy Markdown

Per the Fetch spec, a multipart/form-data part without a filename is decoded with "UTF-8 decode without BOM", which preserves a leading U+FEFF. The parser used encoding_new_decoder_with_bom_removal, which strips it, so "\uFEFFhello" was returned as "hello".

Use encoding_new_decoder_without_bom_handling, matching the spec text already quoted in the surrounding comment. Add an integration test.

Per the Fetch spec, a multipart/form-data part without a filename is
decoded with "UTF-8 decode without BOM", which preserves a leading
U+FEFF. The parser used encoding_new_decoder_with_bom_removal, which
strips it, so "\uFEFFhello" was returned as "hello".

Use encoding_new_decoder_without_bom_handling, matching the spec text
already quoted in the surrounding comment. Add an integration test.

Signed-off-by: Daijiro Wachi <daijiro.wachi@gmail.com>
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