CryptoSys PKI Toolkit Manual

CNV_Latin1FromUTF8

CNV_Latin1FromUTF8 converts a UTF-8 string into Latin-1, if possible.

VB6/VBA Syntax

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)

Parameters

strOutput
[out] String to receive the output.
nOutChars
[in] Long specifying the maximum number of characters to be received.
strInput
[in] String of UTF-8 characters to be decoded.

C/C++ Syntax

long _stdcall CNV_Latin1FromUTF8(char *szOutput, long nOutChars, const char *szInput);

Returns (VB6/C)

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.

.NET Equivalent

Use the in-built method System.Text.Encoding.

Remarks

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.

Example

See CNV_UTF8FromLatin1.

See Also

CNV_UTF8FromLatin1 CNV_CheckUTF8

[Contents] [Index]

[HOME]   [NEXT: CNV_UTF8FromLatin1...]

Copyright © 2004-10 D.I. Management Services Pty Ltd. All rights reserved.