Unicode support in OpenCV

Hello,
I am working on Rebol/OpenCV extension and I would like to add support for Unicode text input. I expected, that OpenCV will accept UTF-8 encoded texts in functions like imread or imshow, but at least on Windows it does not work…

When having for a test purpose code like:

std::string wstringToUtf8(const std::wstring &wstr) {
    if (wstr.empty()) return std::string();
    int size_needed = WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), NULL, 0, NULL, NULL);
    std::string strTo(size_needed, 0);
    WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), &strTo[0], size_needed, NULL, NULL);
    return strTo;
}

and later

    // Define a window title with Unicode characters
    std::wstring unicodeTitle = L"podběl";
    std::string utf8Title = wstringToUtf8(unicodeTitle);

    cv::imshow(utf8Title, resized_image);
    cv::waitKey(0);

The title is not correct:
image

The same in other functions… so what am I missing?
Thanks,
Oldes

If I understand this answer c++ - Can't display unicode on title bar in WIN32 - Stack Overflow it is not possible without a PR :
opencv use CreateWindow

while you’re at it, someone here has a workaround for imread/imwrite using old windows “8.3” style paths:

Yeh… I somehow thought, that I missed something, but now I can see that Unicode support was requested in year 2010 and it is still not resolved… I wonder how such a basic functionality still may be missing.

Using MSDOS paths may work for IO, but that is not a solution as there are other text inputs in OpenCV, which will have the same issues.

I can try to compile OpenCV with UNICODE and _UNICODE defines, so it could at least accept wide char texts, but if it would work, it would work only with my own libraries :-/