CNV_Latin1FromUTF8 converts a UTF-8 string into Latin-1, if possible.
Public Declare Function CNV_Latin1FromUTF8 Lib "diCrPKI.dll"
(ByVal strOutput As String, ByVal nOutChars As Long, ByVal strInput As String) As Long
nLen = CNV_Latin1FromUTF8(strOutput, nOutChars, strInput)
String to receive the output.Long specifying the maximum number of characters to be received.String of UTF-8 characters to be decoded.
long _stdcall CNV_Latin1FromUTF8(char *szOutput, long nOutChars, const char *szInput);
Long: If successful, the return value is a positive number indicating the
number of characters in the output string, or number of characters required if nOutChars is zero;
otherwise it returns a negative error code.
Use the in-built method System.Text.Encoding.
Will set up to nOutChars characters in the output string. If nOutChars is zero, it returns the required number of characters. All output characters must be 8-bit ANSI characters or the function will return an error. Possible errors are INVALID_DATA_ERROR indicating invalid UTF-8 input and OUT_OF_RANGE_ERROR which indicates that the output would contain a character greater than 8 bits in size.
See CNV_UTF8FromLatin1.
CNV_UTF8FromLatin1 CNV_CheckUTF8