The following are some common tasks you need to perform when using a standard converter:
NOTE:If the minimum size of the output buffer for the Unicode string is important to your application but is not known, see Performing a Standard Conversion on a String of Unknown Size.
If you have not already done so, call NWUSStandardUnicodeInit.
Supply an output buffer of sufficient size to hold the output Unicode string.
Call NWUSByteToUnicode or NWUSLenByteToUnicode unless the string is a path. For path strings, call NWUSByteToUnicodePath or NWUSLenByteToUnicodePath.
Use the Unicode string pointed to by unicodeOutput as needed when the function returns.
After all standard Unicode conversion operations are completed, call NWUSStandardUnicodeRelease.
NOTE:If the required size for the output byte string buffer is not known, see Performing a Standard Conversion on a String of Unknown Size.
If you have not already done so, call NWUSStandardUnicodeInit.
Supply an output buffer of sufficient size to hold the output byte string.
Call NWUSUnicodeToByte or NWUSUnicodeToUntermByte unless the string is a path. For path strings, call NWUSUnicodeToBytePath or NWUSUnicodeToUntermBytePath.
When the function returns, use the Unicode string pointed to by unicodeOutput as needed.
After all standard Unicode conversion operations are completed, call NWUSStandardUnicodeRelease.
For related information, see Converting Bytes to Unicode with a Standard Converter
If you have not done so already, call NWUSStandardUnicodeInit.
Convert as explained in Converting Bytes to Unicode with a Standard Converter or Converting Unicode to Bytes with a Standard Converter, but call one of the following path-specific functions:
If you have not already done so, call NWUSStandardUnicodeInit.
Call the appropriate conversion function, but set the output buffer to NULL. The outputBufferLen parameter is then ignored.
NWUSByteToUnicode(NULL, 0, byteInput, &actualLength);
Add one to the returned actualLength for the NULL terminator. If the output is to be a Unicode string, multiply actualLength by sizeof(unicode) to get the required number of bytes. Then allocate memory.
bufsiz=actualLength+1;
outbuf=(punicode)malloc(bufsize*sizeof(unicode));
Do the real conversion.
NWUSByteToUnicode(outbuf, bufsize, byteInput, NULL);
After all standard Unicode conversion operations are completed, call NWUSStandardUnicodeRelease.
Call NWUSGetCodePage. On return, the pCodePage parameter points to the code page and the pCountry parameter points to the country code used by the standard converter currently loaded. If a standard converter is not currently loaded, NWUSGetCodePage returns the code page and country code that will be used when NWUXStandardUnicodeInit is called.
For related information, see: