pub fn wtf8ToWtf16Le(wtf16le: []u16, wtf8: []const u8) error
pub fn wtf8ToWtf16Le(wtf16le: []u16, wtf8: []const u8) error{ BadPathName, NameTooLong }!usize { // Each u8 in UTF-8/WTF-8 correlates to at most one u16 in UTF-16LE/WTF-16LE. if (wtf16le.len < wtf8.len) { const utf16_len = std.unicode.calcUtf16LeLenImpl(wtf8, .can_encode_surrogate_half) catch return error.BadPathName; if (utf16_len > wtf16le.len) return error.NameTooLong; } return std.unicode.wtf8ToWtf16Le(wtf16le, wtf8) catch |err| switch (err) { error.InvalidWtf8 => return error.BadPathName, }; }