Skip to content

Commit

Permalink
LibWeb: Fix UTF-16BE/LE not converting to UTF-8
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaycadox committed Jan 3, 2025
1 parent 0a6793c commit fffdb5c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Libraries/LibWeb/HTML/Parser/HTMLEncodingDetection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,8 @@ Optional<ByteString> run_prescan_byte_stream_algorithm(DOM::Document& document,

if (!need_pragma.has_value() || (need_pragma.value() && !got_pragma) || !charset.has_value())
continue;
if (charset.value() == "UTF-16BE/LE")
// https://encoding.spec.whatwg.org/#common-infrastructure-for-utf-16be-and-utf-16le
if (charset.value() == "UTF-16BE" || charset.value() == "UTF-16LE")
return "UTF-8";
else if (charset.value() == "x-user-defined")
return "windows-1252";
Expand Down

0 comments on commit fffdb5c

Please sign in to comment.