Skip to main content

TrFile_ConvertFromFMText (function reference)

By June 1, 2024June 4th, 2024Online Help, Troi File Plug-in
Troi File Plug-in > Functions reference > TrFile_ConvertFromFMText
Troi File Plug-in for FileMaker Pro


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

SyntaxFunction badge

TrFile_ConvertFromFMText ( switches ; text )


switches reserved for future use, leave empty or set to "-Unused"
text the text in internal FileMaker format

Returned Result

Data type returned



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.

Originated in

Troi File Plug-in 2.0


FileMaker Pro 17 to FileMaker Pro 21 (2024)


NOTE Function not recommended, only for compatibility with older plug-in scripts.
Please use the “-Encoding=xxx” switches of TrFile_AppendContents and TrFile_SetContents instead. This function also converts line endings. In the internal FileMaker format (and on Mac) lines end with a single <CR> character. On Windows this function will replace all CR’s to the normal line ending on Windows, the two characters <CR><LF>.


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

Set Field [ result ; TrFile_ConvertFromFMText ( "-Unused" ; "Bjørn, ¶Münchenstraße 2" ) ]

The result will look like:
M¸nchenstrafle 2”.

This may look wrong, but when you use for example the TrFile_SetContents function it will appear correct in the file.

Example 2

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

    contents		text
    gErrorCode		Global, number
    gOutputFile		Global, text
    gContentsConverted	Global, text

gOutputFile should contain the path to a non-existing file, for example “D:\Out.txt” (Windows) or “Mac HD:Out.txt” (Mac). In a script add the following script steps:

Set Field [ gContentsConverted ; TrFile_ConvertFromFMText ( "-Unused" ; contents ) ]

# now gContentsConverted is in the format of the operating system
Set Field [ gErrorCode ; TrFile_CreateFile ( "-Unused" ; gOutputFile ) ]
Set Field [ gErrorCode ; TrFile_SetDefaultFileSpec ( "-Unused" ; gOutputFile) ]

If [ gErrorCode = 0 ]
   Set Field [ gErrorCode ; TrFile_SetContents ( "-Unused" ; gContentsConverted ) ]
End If 

This will get the contents of the contents field into the file. In the first step the high ASCII characters will be converted from 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 17 to 2024 –> TrFile_ConvertFromFMText (filep4204) 2024-0604 19:22:23