Text conversion v0.1.0
Converting between code pages and UTF-16.
MultiByteToWideChar
pub extern func MultiByteToWideChar(
codePage: CodePage,
flags: uint32,
multiByteStr: *char8,
multiByte: int32,
wideCharStr: *char16,
wideChar: int32
) -> int32
pub extern func MultiByteToWideChar(
codePage: uint32,
flags: uint32,
multiByteStr: *char8,
multiByte: int32,
wideCharStr: *char16,
wideChar: int32
) -> int32
Maps a character string to a UTF-16 wide character string.
See also: https://learn.microsoft.com/en-us/windows/win32/api/stringapiset/nf-stringapiset-multibytetowidechar
Parameters
| Name | Type | Description |
|---|---|---|
codePage | CodePage / uint32 | the code page to convert through, as a CodePage value |
flags | uint32 | the call's flag bits, combined with | |
multiByteStr | *char8 | the bytes to convert |
multiByte | int32 | how many bytes, or -1 to stop at the terminator |
wideCharStr | *char16 | receives the UTF-16 units, or null to ask how many are needed |
wideChar | int32 | how many units the output holds, or zero to ask |
Returns: the units written, the units needed when asked, or zero on failure
WideCharToMultiByte
pub extern func WideCharToMultiByte(
codePage: uint32,
flags: uint32,
wideCharStr: *char16,
wideChar: int32,
multiByteStr: *char8,
multiByte: int32,
defaultChar: *char8,
usedDefaultChar: *bool32
) -> int32
Converts UTF-16 text to another code page.
See also: https://learn.microsoft.com/en-us/windows/win32/api/stringapiset/nf-stringapiset-widechartomultibyte
Parameters
| Name | Type | Description |
|---|---|---|
codePage | uint32 | the code page to convert through, as a CodePage value |
flags | uint32 | the call's flag bits, combined with | |
wideCharStr | *char16 | receives the UTF-16 units, or null to ask how many are needed |
wideChar | int32 | how many units the output holds, or zero to ask |
multiByteStr | *char8 | the bytes to convert |
multiByte | int32 | how many bytes, or -1 to stop at the terminator |
defaultChar | *char8 | the byte to substitute for an unconvertible unit, or null |
usedDefaultChar | *bool32 | receives whether any substitution happened, or null |
Returns: the bytes written, the bytes needed when asked, or zero on failure