Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5d

Application v 5.25a

  

 

Chapter FiveGeneral Functions (continued)

UTFToAnsi Function

Overview

The UTFToAnsi function takes a UTF encoded string and converts it into a 8-bit wide string. Such a conversion may result in loss of data.

Syntax/Parameters

Syntax

string = UTFToAnsi ( string data );

Parameters

data

A string containing UTF text to convert.

Return Value

Returns a string containing the converted string. Use the IsError, IsNotError and GetLastError functions to determine if an error occurred and to retrieve a formatted error code.

If characters cannot be converted, a error condition will be set with an error code in the lo word of the formatted error code.

Remarks

Characters are copied from 8- to 8-bits and those that are UTF are decoded. If sequence is not in valid UTF syntax, each original character is copied. Since the result is 8-bits wide, any characters too large to fit are replaced with Ctrl+? or 0x1F and counted as errors.

Aside from truncating characters over 0xFF, character positions are not translated.

Use of the Ctrl+? (0x1F) character allows the caller to find bad characters without the ambiguity of a simple question mark. If desired, the character can be replaced with the ReplaceInString function to turn them into a ‘?’ or some other character.

Related Functions

Platform Support

Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL

Legato IDE, Legato Basic

Page revised 2024-12-13