NWUSUnicodeToByte
Converts a NULL-terminated Unicode string into a byte string
#include <nunicode.h> N_EXTERN_LIBRARY(nint) NWUSUnicodeToByte ( pnuint8 byteOutput, nuint outputBufferLen, const unicode N_FAR *unicodeInput, pnuint actualLength);
uses netwin32 Function NWUSUnicodeToByte (byteOutput : pnuint8; outputBufferLen : nuint; unicodeInput : punicode; actualLength : pnuint ): nint;
Call NWUSUnicodeToBytePath whenever the Unicode string to be converted is a file path.
The NWU_BUFFER_FULL error can occur because the output buffer has been allocated with insufficient space. Because of the default conversion behavior described above, byte strings can be as much as six times longer than the number of characters in the input string (or three times longer than the number of bytes in the input string).
NWUSUnicodeToByte converts an unmappable Unicode character into a special 6-byte sequence. For example, 0x2620 is converted to "[2620]".
NWUSUnicodeToByte does not recognize any special Unicode sequences for conversion. For example, the Unicode string "ab[81]cd" will be returned as the byte string "ab[81]cd".
Call NWUSUnicodeToByte to determine the size of the string before it is converted by setting the byteOutput parameter to NULL. The outputBufferLen parameter will be ignored, a converted string will not be returned, and the length of the string if it were converted will be returned in the actualLength parameter.
See esunib.c for sample code.