This section explains the language settings for the application runtime environment and the encoding settings for the application.
You must match the language settings for the application runtime environment with the message locale settings of the database server.
Linux
The language settings are made with the LANG environment variable or with the setlocale function in the source code.
LANG environment variable settings
Apart from LANG, other environment variables for specifying language are LC_ALL and LC_MESSAGES. When multiple of these environment variables are set, the order of priority will be 1. LC_ALL, 2. LC_MESSAGES, and 3. LANG.
Example
Example of specifying "en_US.UTF-8" with the LANG environment variable (Bash)
> LANG=en_US.UTF-8; export LANG
Settings for setlocale
Set the language of the application using the setlocale function in the source code.
Example
Example of specifying "en_US.UTF-8" with the setlocale function
setlocale(LC_ALL,"en_US.UTF-8");
Information
Refer to the documentation for the operating system for information on using the setlocale function.
Windows(R)
Follows the locale of the OS.
Ensure that the encoding system that is embedded in the application and passed to the database, and the encoding system setting of the runtime environment, are the same. The encoding system cannot be converted correctly on the database server.
Use one of the following methods to set the encoding system for the application:
Set the PGCLIENTENCODING environment variable in the runtime environment.
Set the client_encoding keyword in the connection string.
Use the PQsetClientEncoding function.
See
Refer to "Supported Character Sets" in "Server Administration" in the PostgreSQL Documentation for information on the strings that represent the encoding system that can be set.
For example, when using "Unicode" and "8 bit", set the string "UTF8".
Note
Text may be garbled when outputting results to the command prompt. Review the font settings for the command prompt if this occurs.