Skip to content

Commit 740ca4f

Browse files
committed
Remove use of std::string
1 parent 603bffa commit 740ca4f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

icu4c/source/i18n/messageformat2.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,10 @@ FunctionContext MessageFormatter::makeFunctionContext(const FunctionOptions& opt
181181
localeToUse = locale;
182182
} else {
183183
UErrorCode localStatus = U_ZERO_ERROR;
184-
std::string u8;
185-
Locale l = Locale::forLanguageTag(localeStr.toUTF8String(u8), localStatus);
184+
int32_t len = localeStr.length();
185+
LocalArray<char> temp(new char[len + 1]);
186+
localeStr.extract(0, len, temp.getAlias(), len);
187+
Locale l = Locale::forLanguageTag(StringPiece(temp.getAlias(), len), localStatus);
186188
if (U_SUCCESS(localStatus)) {
187189
localeToUse = l;
188190
} else {

0 commit comments

Comments
 (0)