From 55e45856aee7e735d55cf095bc7de7aaf541fe0c Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Tue, 24 Jan 2023 08:55:51 -0500 Subject: [PATCH] LibGfx: Use x-mac-roman TextCodec for decoding MacRoman text --- Userland/Libraries/LibGfx/ICCProfile.cpp | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/Userland/Libraries/LibGfx/ICCProfile.cpp b/Userland/Libraries/LibGfx/ICCProfile.cpp index 0b96ef625d..aae119683e 100644 --- a/Userland/Libraries/LibGfx/ICCProfile.cpp +++ b/Userland/Libraries/LibGfx/ICCProfile.cpp @@ -834,17 +834,7 @@ ErrorOr> TextDescriptionTagData::from_byte if (macintosh_description_data[macintosh_description_length - 1] != '\0') return Error::from_string_literal("ICC::Profile: textDescriptionType ScriptCode not \\0-terminated"); - bool is_ascii = true; - for (u32 i = 0; i < macintosh_description_length; ++i) { - if (macintosh_description_data[i] >= 128) - is_ascii = false; - } - - if (is_ascii) { - macintosh_description = TRY(String::from_utf8(StringView { macintosh_description_data, (size_t)macintosh_description_length - 1 })); - } else { - dbgln("TODO: ICCProfile textDescriptionType non-ASCII MacRoman"); - } + macintosh_description = TRY(String::from_deprecated_string(TextCodec::decoder_for("x-mac-roman")->to_utf8({ macintosh_description_data, (size_t)macintosh_description_length - 1 }))); } else { dbgln("TODO: ICCProfile textDescriptionType ScriptCode {}, length {}", scriptcode_code, macintosh_description_length); }