Skip to content

Commit

Permalink
Remove use of std::string
Browse files Browse the repository at this point in the history
  • Loading branch information
catamorphism committed Oct 17, 2024
1 parent 603bffa commit 740ca4f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions icu4c/source/i18n/messageformat2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,10 @@ FunctionContext MessageFormatter::makeFunctionContext(const FunctionOptions& opt
localeToUse = locale;
} else {
UErrorCode localStatus = U_ZERO_ERROR;
std::string u8;
Locale l = Locale::forLanguageTag(localeStr.toUTF8String(u8), localStatus);
int32_t len = localeStr.length();
LocalArray<char> temp(new char[len + 1]);
localeStr.extract(0, len, temp.getAlias(), len);
Locale l = Locale::forLanguageTag(StringPiece(temp.getAlias(), len), localStatus);
if (U_SUCCESS(localStatus)) {
localeToUse = l;
} else {
Expand Down

0 comments on commit 740ca4f

Please sign in to comment.