Skip to content

Commit d3a3ca5

Browse files
committed
Remove use of std::string
1 parent 7bc87ba commit d3a3ca5

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
@@ -226,8 +226,10 @@ FunctionContext MessageFormatter::makeFunctionContext(const FunctionOptions& opt
226226
localeToUse = locale;
227227
} else {
228228
UErrorCode localStatus = U_ZERO_ERROR;
229-
std::string u8;
230-
Locale l = Locale::forLanguageTag(localeStr.toUTF8String(u8), localStatus);
229+
int32_t len = localeStr.length();
230+
LocalArray<char> temp(new char[len + 1]);
231+
localeStr.extract(0, len, temp.getAlias(), len);
232+
Locale l = Locale::forLanguageTag(StringPiece(temp.getAlias(), len), localStatus);
231233
if (U_SUCCESS(localStatus)) {
232234
localeToUse = l;
233235
} else {

0 commit comments

Comments
 (0)