Multilingual Database Support with Legacy and OEM Encodings
If you choose to store text using a legacy or OEM code page, you will use the CHAR, VARCHAR, and LONGVARCHAR relational types. You may use wide character applications if you configure the access method to do conversion to your legacy code page.
When to Use a Legacy Code Page
Using a legacy code page is a compact and efficient way to store text data provided that the legacy code page defines a character set that meets the needs of your application.
Legacy Code Page Support in PSQL
The PSQL database engine assumes that CHAR data is encoded using the database code page. The access methods have configuration options that help ensure that this is the case.
Older applications that use OEM code pages for storage did not declare the database code page. You can continue to work with this situation so long as the application is careful to use the appropriate relational string functions.
Collation and Sorting with Legacy Code Pages
The default collation in PSQL is binary ordering of the encoded bytes. The declared database code page does not affect this default collation.
PSQL provides both alternate collating sequence (ACS) and international sorting rules (ISR) mechanisms for controlling collation. These may be declared on Btrieve indexes and on relational columns. PSQL will always use a particular ACS for the ASCII character set when using the CASE declaration on a relational column or the case-insensitive bit on a Btrieve index.
Access Methods for Legacy Code Pages
All PSQL access methods support byte-string text. Some assume that the database code page is the same as the application’s code page, and some allow configuration.
•
The ANSI ODBC drivers provide a DSN setting, OEM/ANSI translation, which declares that the application OEM code page (as distinct from ANSI code page) is the database code page. The ANSI ODBC drivers also support the encoding property in connection strings and the pvtranslate=auto option.
•
The Unicode ODBC driver always operates as if the pvtranslate_true property is set and translates application CHAR data to the database code page as needed.
•
The JDBC driver has an explicit encoding property in the connection string. The driver will set encoding to the database code page if the pvtranslage=auto property is given.
•
The ADO.NET provider has an explicit encoding connection property. The driver will set Encoding to the database code page if the PvTranslate=Auto connection property is given.
•
The PDAC access method for Delphi has the OEMConversion property that controls whether CHAR data is sent to the engine using the OEM code page or the ANSI (ACP) code page.
Migrating an Existing Database to a Different Legacy Code Page
Changing the code page of a database requires copying the data to a new database that uses the new code page. The copy must be done by your application. PSQL does not translate code pages within a transaction.
If your database metadata use characters that require translation, those changes must be made when creating the schema of the new database. Table names are a common example of this type of metadata.