MKI_ConvertUTF16ToUntaggedAnsi (Strings) New in Version 2019.1

www.CAD6.com

C++ Syntax

bool

MKI_ConvertUTF16ToUntaggedAnsi(

 const LPCWSTR f_pszSource,

 LPSTR f_pszDestin,

 const size_t f_unMaxSize );

 

 template <size_t f_unSize> bool

 MKI_ConvertUTF16ToUntaggedAnsi(

         const LPCWSTR f_pszSource,

         char (&f_rDestin)[f_unSize] )

 

Converts a UTF-16 Unicode text to an Ansi text without Unicode encoding and without any text formatting tags.

 

Parameters

Source

[const LPCWSTR] Address of the source UTF-16 text.

Destin

[LPSTR] Pointer to or [char[]&] Reference to an Ansi string that shall receive the converted text with a fixed maximum length. Unicode characters outside the Ansi codepage will be converted to a '?' character.

MaxSize

[const size_t] Maximum allowed length of the destination text in Ansi characters including the terminating '\0' character.

 

Return Value

Returns true if the conversion was successful and the resulting string fit into the buffer. If false is returned since the buffer was too small, as many characters as possible were already converted and terminated by a '\0' character.

 

Comment

The resulting text will always be terminated with a '\0' character if the buffer size is at least 1, even if false is returned! The text may, however, be truncated.

 

CAD6interface 2025.0 - Copyright 2025 Malz++Kassner® GmbH