Parent Previous Next


Converts a blob into a string - going from a specified codepage to the Unicode format of the internal string type.

A special feature is the possibility of doing base64 conversions.


 @EncodeBytesToString(Blob bytes; Integer fromCodepage) : String




 Blob fileBytes;

 @FileReadBytes("c:\test\file_in_utf8.txt", fileBytes);

 Integer cpUTF8 := 65001; //the utf8 codepage;

 String fileText := @EncodeBytesToString(fileBytes, cpUTF8);


If codepage is set to -64 (which is not a real codepage value) a special feature is invoked that converts the blob into a string containing only base64 acceptable characters to represent the byte sequence. The resulting string can afterwards be saved to a file using a single byte codepage format (ASCII, ANSI etc.) - however even UTF-8 represents the lower end characters within an 8 bit range.

Please be aware, the resulting string of base64 characters may also contain CRLF characters - in reference to a block length of 76.