Omnis Technical Note TNGI0011
Handling the conversion of a Mac text file to an ANSI (PC) text file with Omnis Studio
For Omnis Studio
By Rudolf Bargholz
Summary
The following object allows developers who create text files in Omnis
Studio on the Mac to be able to create Windows readable text files. It
is coded entirely in Omnis. The character conversion table used for the
conversion from Mac to Windows is saved as a list and could be used as
a basis for anyone that wants to write an external to perform the same
function. The external would of course be a lot faster. The enclosed library
has a test window and a Mac test text file.
Object details
The object handles the conversion of a Mac text file to an ANSI (PC) text
file. The Mac uses it's own character set that is not identical to that
used in Windows. For characters < 128 this has no effect, but for special
characters such as the German umlauts, these are not mapped correctly.
A file that looks fine on the Mac will not display the correct characters
when the same file is opened on a Windows machine. If you wish to create
a Windows readable file when working on the Mac you can use this object
class to create a relatively well mapped file. This object basically replaces
the Mac character with another character, which when displayed on a Windows
machine will show the same character as seen on the Mac, for example,
a 'Ü' on the Mac will be converted to a '<'. When the Mac character
for '<' is displayed in Windows, Windows will display a 'Ü'. Please
note that Windows cannot display all the characters of the Mac character
set, as is the case with the Mac apple character, and vice-versa. Characters
that cannot be mapped are replaced with a space character. Another point
to remember is that there are generally two types of fonts in Windows,
ANSI (PC) and ISO 8859-1 Latin1 fonts. The latter is a subset of the former.
'Fixedsys' is an example of an ISO 8859-1 Latin1 font, whereas 'Arial'
is an example of an ANSI (PC) font. Displaying text in 'Arial' will display
a few more special characters than when using 'Fixedsys'.
Please open the library below on a Mac and follow the instructions therein.
A Mac text file has also been provided for the demonstration.
Download: macwin.lbs