diff --git a/src/lib/icu/Transliterator.cxx b/src/lib/icu/Transliterator.cxx index b1470d609..71121dca2 100644 --- a/src/lib/icu/Transliterator.cxx +++ b/src/lib/icu/Transliterator.cxx @@ -24,12 +24,14 @@ #include static UTransliterator * -OpenTransliterator(const UChar *id, const UChar *rules) +OpenTransliterator(std::basic_string_view id, + std::basic_string_view rules) { UErrorCode error_code = U_ZERO_ERROR; - UTransliterator *t = utrans_openU(id, -1, UTRANS_FORWARD, - rules, -1, + UTransliterator *t = utrans_openU(id.data(), id.size(), + UTRANS_FORWARD, + rules.data(), rules.size(), nullptr, &error_code); if (t == nullptr) throw std::runtime_error(u_errorName(error_code)); @@ -37,7 +39,8 @@ OpenTransliterator(const UChar *id, const UChar *rules) return t; } -IcuTransliterator::IcuTransliterator(const UChar *id, const UChar *rules) +IcuTransliterator::IcuTransliterator(std::basic_string_view id, + std::basic_string_view rules) :transliterator(OpenTransliterator(id, rules)) { } diff --git a/src/lib/icu/Transliterator.hxx b/src/lib/icu/Transliterator.hxx index cad083fec..1fd93e333 100644 --- a/src/lib/icu/Transliterator.hxx +++ b/src/lib/icu/Transliterator.hxx @@ -41,7 +41,8 @@ public: /** * Throws on error. */ - IcuTransliterator(const UChar *id, const UChar *rules); + IcuTransliterator(std::basic_string_view id, + std::basic_string_view rules); ~IcuTransliterator() noexcept { if (transliterator != nullptr)