diff --git a/AK/String.cpp b/AK/String.cpp index 52cfe7e3716..1ae9923ecab 100644 --- a/AK/String.cpp +++ b/AK/String.cpp @@ -24,7 +24,7 @@ namespace AK { String String::from_utf8_with_replacement_character(StringView view, WithBOMHandling with_bom_handling) { - if (auto bytes = view.bytes(); with_bom_handling == WithBOMHandling::Yes && bytes.size() >= 3 && bytes[0] == 0xEF && bytes[1] == 0xBB && bytes[2] == 0xBF) + if (auto bytes = view.bytes(); with_bom_handling == WithBOMHandling::Yes && bytes.starts_with({ { 0xEF, 0xBB, 0xBF } })) view = view.substring_view(3); if (Utf8View(view).validate())