- Match->Open[i] = ucr::stringlen_of_utf8(compString.c_str(), ovector[i].offset);
- Match->Close[i] = ucr::stringlen_of_utf8(compString.c_str(), ovector[i].offset + ovector[i].length);
+ std::wstring utf16str;
+ UnicodeConverter::toUTF16(std::string(compString.c_str(), ovector[i].offset), utf16str);
+ Match->Open[i] = utf16str.length();
+ UnicodeConverter::toUTF16(std::string(compString.c_str() + ovector[i].offset, ovector[i].length), utf16str);
+ Match->Close[i] = Match->Open[i] + utf16str.length();