diff --git a/components/l10n/messagebundles.cpp b/components/l10n/messagebundles.cpp index fab59a7cb8..6934dcaad8 100644 --- a/components/l10n/messagebundles.cpp +++ b/components/l10n/messagebundles.cpp @@ -75,7 +75,7 @@ namespace l10n { const auto key = it.first.as(); const auto value = it.second.as(); - icu::UnicodeString pattern = icu::UnicodeString::fromUTF8(value); + icu::UnicodeString pattern = icu::UnicodeString::fromUTF8(icu::StringPiece(value.data(), value.size())); icu::ErrorCode status; UParseError parseError; icu::MessageFormat message(pattern, lang, parseError, status); @@ -112,7 +112,7 @@ namespace l10n std::vector argValues; for (auto& [k, v] : args) { - argNames.push_back(icu::UnicodeString::fromUTF8(k)); + argNames.push_back(icu::UnicodeString::fromUTF8(icu::StringPiece(k.data(), k.size()))); argValues.push_back(v); } return formatMessage(key, argNames, argValues); diff --git a/components/lua/l10n.cpp b/components/lua/l10n.cpp index 1da6693f3d..4a1e533f2d 100644 --- a/components/lua/l10n.cpp +++ b/components/lua/l10n.cpp @@ -68,7 +68,8 @@ namespace LuaUtil } // Argument names - argNames.push_back(icu::UnicodeString::fromUTF8(key.as())); + const auto str = key.as(); + argNames.push_back(icu::UnicodeString::fromUTF8(icu::StringPiece(str.data(), str.size()))); } return std::make_pair(args, argNames); }