TXT_to_UTF8 ( Text )
Converts text to UTF-8 encoding
Average rating: 3.9 (49 votes) Log in to vote
Ibrahim Bittar Torres
Eikonsys, S.A. de C.V.
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
Each Unicode character has an UTF-8 byte value, however, the representation of these values in a text field in FileMaker are different depending on the platform. This is because the Mac Roman and the Windows 1252 (wrongly known as Latin-1) character encoding tables are different.
For example, if you want to convert the â character to UTF-8 see what happens:
In UTF-8 the character â is represented by the bytes C3 A2. If you look into the Mac Roman table you'll find that C3 is √ and A2 is ¢ but in the Windows table C3 is Ã and A2 is ¢ so to represent a high ASCII character in UTF-8 you need to use both characters. √¢ for Mac and Ã¢ for Windows.
This is exactly what this CF does. It substitutes every high ASCII character with its corresponding character pair on the Mac Roman or Windows 1252 encoding table.
This is very useful to encode an XML text calculation before converting to Base64 and sending it to a web service for example.
Ibrahim Bittar, León, México
Aug 11, 2014
|This function has been updated so the platform is no longer needed as a parameter. I also fixed some bugs on Windows conversion.|
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.