TrFile_ConvertToFMText (function reference)

By January 1, 2021January 26th, 2021Online Help, Troi File Plug-in
Troi File Plug-in > Functions reference > TrFile_ConvertToFMText
Troi File Plug-in for FileMaker Pro


Converts text formatted in the format of the current operating system running on this computer to text formatted in the internal FileMaker format. On Windows the High ASCII characters (128-255) are not the same as stored internally in FileMaker.

SyntaxFunction badge

TrFile_ConvertToFMText ( switches ; text )


switches reserved for future use, leave empty or set to "-Unused"
text the text in the native format of the operating system of this computer. This will be Windows format on Windows and macOS format on macOS

Returned Result

Data type returned



The text in internal FileMaker format.

Originated in

Troi File Plug-in 2.0


FileMaker Pro 16 to 19


NOTE Function not recommended, only for compatbility with older plug-in scripts.
Use the “-Encoding=xxx” switches of TrFile_AppendContents and TrFile_SetContents instead. This function also converts line endings to the internal format. On Windows lines end with the two ASCII characters <CR><LF>. This is converted to the single character <CR> as used by the internal FileMaker format.


Assume that on Windows we have the file “HighText.Doc”, which contains the text “Bjørn, <CR><LF>Münchenstraße 2”. Add this script step:

Set Field [ result; TrFile_ConvertToFMText ( "-Unused" ;  
                                   TrFile_GetContents ( "-Unused" ; "C:\HighText.Doc" ) ) ]

This will store the contents of the “HighText.Doc” in the result field, with the high ASCII characters converted to the internal FileMaker format. In the result field this will look like this:

Bjørn, ¶
Münchenstraße 2

Example 2

We assume that in your FileMaker file the following fields are defined:

    contents		text
    gFileSpec		Global, text 

gFileSpec should contain the path to an existing file, for example “D:\Readme.txt” (Windows) or “Mac HD:Readme.txt” (Mac). In a script add the following script step:

Set Field [ contents ; TrFile_GetContents ( "-Unused" ; gFileSpec ) ]
# Now the contents field is in the format of the operating system
Set Field [ contents ; TrFile_ConvertToFMText ( "-Unused" ; contents ) ]

This will get the contents of the file into the contents field. In the second step the high ASCII characters will be converted to the internal FileMaker format. This will work transparent on both macOS and Windows.

Related functionsFunction badge


Related topics

Troi File Plug-in online help (overview)

Online Help Page for Troi File Plug-in for 16 to 19 –> TrFile_ConvertToFMText (filep4205) 2021-0125 21:09:15