WideCharToMultiByte return is the string length without null terminate character if passed "cchWideChar" does not include the null terminate character size. Instead of passing the exact string length, pass -1 so that the API can understand the input string is null terminated already and returned value from the API includes the character. Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3023 Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5444>