wpt: decode non-UTF-8 test files honouring BOM and declared encoding - #659
Open
nicoburns wants to merge 1 commit into
Open
wpt: decode non-UTF-8 test files honouring BOM and declared encoding#659nicoburns wants to merge 1 commit into
nicoburns wants to merge 1 commit into
Conversation
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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.
Summary
The runner crashed with
stream did not contain valid UTF-8on 11 css tests encoded as UTF-16 or a legacy encoding (css/CSS2/i18n/syndata/character-encoding-*.xht,css/css-syntax/charset/page-utf16-*.html), becauseprocess_test_fileusedfs::read_to_string(...).unwrap().Test files are now read as bytes and decoded via
decode_file_bytes:encoding_rs::Encoding::for_bom) wins;encoding=/charset=in an XML declaration,<meta charset>, or@charset), with a windows-1252 fallback. A declared UTF-16 label maps to UTF-8, per the HTML spec's "get an encoding" algorithm (an ASCII-readable declaration means the content isn't UTF-16).WPT crash counts for
css/CSS2/i18n/syndata+css/css-syntax/charset: 11 CRASH before, 0 after (all now run/skip normally).Note: 4 tests flip PASS→FAIL with this change (
font-family-invalid-characters-001/003.xht,text-emphasis-style-none-001.xht,text-transform-none-001.xht). These files have a UTF-8 BOM which was previously left in the parser input, corrupting parsing so their stylesheets never applied and they trivially matched their (unstyled) refs. With the BOM correctly stripped they actually exercise their styles and expose a separate engine issue: text consisting only of digits is not rendered when the font-family stack contains only unknown families (e.g.font-family: test) — letters fall back correctly but digits disappear.Link to Devin session: https://dioxus.staging.devinenterprise.com/sessions/f1a0d6696eaa4076a48f366a24bfd26f
Requested by: @nicoburns
WPT results
0 newly passing, 4 newly failing (net -4), 11 other status changes.
Full diff (15 changed tests)
Generated by the WPT workflow.