Omnis Technical Note TNSQ0019 April 2008

Mapping Extended Characters with PostgreSQL

For Omnis Studio 4.3.1 and later, Non-Unicode version.
By Gary Ashford

The Problem           é ?

We recently addressed a fault in the PostgreSQL DAM whereby ANSI extended characters (those with character codes >= 0x7F Hex) were not being read and written correctly to the PostgreSQL database.
This was apparent where table names or column names contained accented or umlauted characters.

This problem has been fixed in the latest DAM (released with Studio 4.3.1) by ensuring that all table "metadata" as well as stored character data is passed through the character mapping routines. In doing so however, we identified an issue for the Mac OS X platform where the client character set does not match with the server character set.
This occurs because currently there is no way to specify the MacRoman character set for the client_encoding variable used by the client connection. For a list of supported character sets (PostgreSQL v8.3), click here.
To work around this issue, it is necessary to implement character mapping files to perform the mapping , for example between MacRoman and Latin1. By specifying LATIN1 as the value of client_encoding on the Mac client, the PostgreSQL access library can perform the mapping from the client_encoding to the server_encoding. The reverse mapping is performed for character data returned from the server, i.e; the Omnis file translates the LATIN1 encoded data back to MacRoman.
This process is shown in the following diagram:

About Omnis Character Map Files

In addition to kSessionCharMapNative and kSessionCharMapOmnis, you can assign a DAM session object's $charmap property to kSessionCharMapTable. In this mode, the DAM uses two files (specified using the $charmapfile property) to map character data being read to and written from the DAM.  For example:

Do mySessionObject.$maptable.$assign('Volumes:HDD:charmaps:latin') Returns #F
Do mySqssionObject.$charmap.$assign(kSessionCharMapTable) Returns #F

In this instance, two files named '' and 'latin.out' are placed in a charmaps folder in the root of the HDD volume. The choice of client character set is arbitrary provided that the character set used corresponds with an encoding supported by the client (client_encoding). To use the LATIN1 encoding, we have supplied the required character map files:

Please note that it is only necessary to implement character mapping for Mac OS X. For Windows and Linux, Omnis automatically converts character data to Latin1/ISO8859, (the Windows 'native' character set).

Search Omnis Developer Resources


Hit enter to search