AK: Add BOM handling to String::from_utf8_with_replacement_character

This commit is contained in:
Shannon Booth 2024-08-11 15:19:47 +12:00 committed by Tim Flynn
commit b3bf5c4ea8
Notes: github-actions[bot] 2024-08-12 10:39:57 +00:00
4 changed files with 21 additions and 7 deletions

View file

@ -116,8 +116,8 @@ ErrorOr<Vector<QueryParam>> url_decode(StringView input)
auto space_decoded_value = value.replace("+"sv, " "sv, ReplaceMode::All);
// 5. Let nameString and valueString be the result of running UTF-8 decode without BOM on the percent-decoding of name and value, respectively.
auto name_string = String::from_utf8_with_replacement_character(URL::percent_decode(space_decoded_name));
auto value_string = String::from_utf8_with_replacement_character(URL::percent_decode(space_decoded_value));
auto name_string = String::from_utf8_with_replacement_character(URL::percent_decode(space_decoded_name), String::WithBOMHandling::No);
auto value_string = String::from_utf8_with_replacement_character(URL::percent_decode(space_decoded_value), String::WithBOMHandling::No);
TRY(output.try_empend(move(name_string), move(value_string)));
}