unicodeToAnsi

unicodeToAnsi(): String;

The unicodeToAnsi method of the Binary primitive type interprets the binary as Unicode characters and returns a copy converted to an ANSI string.

This method can be invoked only from an ANSI application.

The code fragment in the following example shows the use of the unicodeToAnsi method.

if fileIsUnicode then
    str := bin.unicodeToString;
else
    str := bin.ansiToString;
endif;
if str.length >= 3 and str[1:3] = "---" then
    rc := true;
endif;

If this method is invoked from a Unicode application, a 1068 - Feature not available in this release exception is raised.

Conversion of the binary stops at the first null character. If the binary contains embedded nulls, the string returned from the conversion therefore represents only that part of the binary up to the first null character.