Xbasic

CONVERT_BLOB_TO_ACP Function

Syntax

Result as C = CONVERT_BLOB_TO_ACP(B data)

Arguments

data

A blob containing UTF-encoded text that needs conversion to ACP.

Description

Converts UTF-8 (with or without BOM), UTF-16, or UTF-32 encoded data in a blob to an ANSI Code Page (ACP) string.

Discussion

The CONVERT_BLOB_TO_ACP() function processes a binary blob containing text in UTF-8, UTF-16, or UTF-32 format and converts it into an ANSI Code Page (ACP) string.

This function detects the encoding type based on Byte Order Marks (BOMs) or assumes UTF-8 if no BOM is found. It then converts the blob accordingly.

This function is useful when handling encoded text data stored in a blob format, ensuring it is properly converted for use in ANSI-based systems.

Example

Example usage of CONVERT_BLOB_TO_ACP():

dim encoded_data as B
dim result as C
' Load or create a blob with UTF-8 encoded data
result = CONVERT_BLOB_TO_ACP(encoded_data)

See Also