How Do I Use UTF-8 Text With Fields?
UTF-8 is a popular text encoding format. While not natively supported in Revolution fields you can display UTF-8 text using some of the built-in Revolution functions. This lesson will show you how.
UTF-8 Encoded Text File
The Revolution Field
Setting Field Contents: Attempt #1
After clicking on the button and selecting my UTF-8 encoded file this is what I see in the field when running on OS X. Not exactly the result I was after. What went wrong? The text property of a field expects text encoded in Mac OS Roman on OS X or ISO 8859-1 on Windows. The characters in my UTF-8 encoded text file are not encoded using the Mac OS Roman character set.
Setting Field Contents: Attempt #2
A field also has a unicodeText property. Let's see what happens if I set the unicodeText property of the field (1) to the contents of my text file.
Notice that I switched from using the file keyword to the binfile keyword when loading the file contents (2). When using file Revolution converts line endings of the text read in. By using binfile Revolution will read in the data without performing any conversions.