Convert a known-length UTF-16 slice into a D UTF-8 string. Embedded NUL characters are preserved; malformed code units are replaced with U+FFFD.
Convert a null-terminated UTF-16 buffer (as returned by Win32) into a D UTF-8 string. Stops at the first NUL. A null pointer yields an empty string.
Convert a D UTF-8 string into a null-terminated UTF-16 buffer suitable for passing to wide Win32 APIs.
UTF-8 ↔ UTF-16 conversion helpers for the Win32 backend.
D strings are UTF-8; the wide Win32 API (...W) speaks UTF-16. These helpers bridge the two using the platform's own MultiByteToWideChar / WideCharToMultiByte, which keeps the library free of any Phobos dependency (smaller binaries) and matches the OS exactly. Conversions are lenient: malformed input (for example a lone surrogate) is replaced with U+FFFD rather than throwing, so a stray value from the OS can never crash the UI.