Hi On Wed, Mar 20, 2024 at 12:39 AM <[email protected]> wrote: > +// Converts from a standard string to a Windows wide string. > +// it is a 16-bit wide character used to store Unicode encoded as UTF-16LE/ > +// some Windows API functions require this format of the string as opposed > to just > +// the normal c char*. This function attempts to convert a standard string to > +// a wide string if it is possible. Some multibyte characters are not > supported > +// so it could throw an error. > +// Read more here: > +// > https://learn.microsoft.com/en-us/cpp/cpp/char-wchar-t-char16-t-char32-t?view=msvc-170 > +// parameters: > +// string - String to convert to a wchar. > +// errp - Error pointer that will set errors if they are converted > +// returns - The converted string or NULL if an error occurs. > +static wchar_t *string_to_wide(const char *string, Error **errp) > +{
There is g_utf8_to_utf16() which can be cast to wchar_t, iirc, that's how glib converts string for w32 api -- Marc-André Lureau
