Guide for Locale Settings

 

This guide provides steps for configuring locale settings. The details for each step of this guide are described further in this chapter.

 

1. Define the application locale by specifying the correct character set used in your source files.

 

By default, each source file is compiled using the encoding specified for its container (program, project or LyciaStudio IDE). So, if your source files initially are using a non-default encoding, remember to specify it in the file properties in Lycia IDE, or use the -e flag if you compile sources in Lycia Command Line.

 

Refer to Setting the Application Locale for more details.

 

2. Make sure that the correct length semantics is used in your application.

 

Some of the character data types require their length to be predefined during declaration, for example, CHAR(n). In multi-byte locales 'n' stands for the number of bytes rather than the number of characters, like it does in the default English U.S. locale. Thus, when declaring variables in multi-byte locales you must remember that each character will most probably take up more than 1 byte.

Different database vendors use different length semantics for character data types. Some databases use BLS (Byte Length Semantics), other use CLS (Character Length Semantics), and other support both semantics.

 

Refer to Character Length Semantics for more details.

 

3. Set the database client locale corresponding to the application locale.

 

Make sure the database client locale and the application locale are the same. If the database client locale differs from the application locale, data will be written incorrectly to the database. Thus, you must make sure the conversion between the client locale and database locale is possible. The database server locale can be different from the database client locale.

 

Refer to Setting the Database Client Locale for more details.

 

5. Check the length semantics used by the database. For example, with Oracle, the NLS_LENGTH_SEMANTICS=CHAR database option should be set, if the application uses CLS.

 

Refer to Multi-Byte Values for more details.

 

6. With UTF-8, use the proper SQL character data type to store UTF-8 data: This data type might be different according to the type of database server.

 

7. Define the date, numeric and monetary formats using the DBDATE, DBMONEY, DBFORMAT environment variables.

 

Refer to Date and Time Settings, and Numeric and Currency Settings for more details.

 

 

Date and Time Settings

Multi-Byte Values

Numeric and Currency Settings

Setting the Application Locale

Setting the Database Locale