diff --git a/Libraries/LibWeb/Fetch/Headers.cpp b/Libraries/LibWeb/Fetch/Headers.cpp index 1d4dbf31a7ecf..a3121e147603f 100644 --- a/Libraries/LibWeb/Fetch/Headers.cpp +++ b/Libraries/LibWeb/Fetch/Headers.cpp @@ -9,6 +9,7 @@ #include #include #include +#include namespace Web::Fetch { @@ -106,7 +107,7 @@ WebIDL::ExceptionOr> Headers::get(String const& name_string) // 2. Return the result of getting name from this’s header list. auto byte_buffer = m_header_list->get(name); - return byte_buffer.has_value() ? MUST(String::from_utf8(*byte_buffer)) : Optional {}; + return byte_buffer.has_value() ? Infra::isomorphic_decode(*byte_buffer) : Optional {}; } // https://fetch.spec.whatwg.org/#dom-headers-getsetcookie diff --git a/Tests/LibWeb/Text/expected/Fetch/fetch-headers-get-nonascii.txt b/Tests/LibWeb/Text/expected/Fetch/fetch-headers-get-nonascii.txt new file mode 100644 index 0000000000000..1927c53d4f0aa --- /dev/null +++ b/Tests/LibWeb/Text/expected/Fetch/fetch-headers-get-nonascii.txt @@ -0,0 +1,2 @@ +before-æøå-after +before-ß-after diff --git a/Tests/LibWeb/Text/input/Fetch/fetch-headers-get-nonascii.html b/Tests/LibWeb/Text/input/Fetch/fetch-headers-get-nonascii.html new file mode 100644 index 0000000000000..73e1f33da5d53 --- /dev/null +++ b/Tests/LibWeb/Text/input/Fetch/fetch-headers-get-nonascii.html @@ -0,0 +1,13 @@ + + +