- UErrorCode error = U_ZERO_ERROR;
- boost::scoped_array<uint16_t> utf16_a(new uint16_t[utf8_a.size() + 1]);
- u_strFromUTF8(reinterpret_cast<UChar*>(utf16_a.get()), utf8_a.size() + 1, nullptr, utf8_a.c_str(), -1, &error);
- boost::scoped_array<uint16_t> utf16_b(new uint16_t[utf8_b.size() + 1]);
- u_strFromUTF8(reinterpret_cast<UChar*>(utf16_b.get()), utf8_b.size() + 1, nullptr, utf8_b.c_str(), -1, &error);
- return ucol_strcoll(_collator, reinterpret_cast<UChar*>(utf16_a.get()), -1, reinterpret_cast<UChar*>(utf16_b.get()), -1);
+ auto utf16_a = utf8_to_utf16(utf8_a);
+ auto utf16_b = utf8_to_utf16(utf8_b);
+ return ucol_strcoll(_collator, utf16_a.data(), -1, utf16_b.data(), -1);