AK: Simplify BOM parsing in String::from_utf8_with_replacement_character
This commit is contained in:
parent
f098bd029c
commit
51afbf5280
1 changed files with 1 additions and 1 deletions
|
|
@ -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())
|
||||
|
|
|
|||
Loading…
Reference in a new issue