This section explains the language settings for the application runtime environment and the character set 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 and 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
Follows the locale of the OS.
It is recommended to match the character set setting of the application with the character set setting of the client. Messages may be garbled if the settings do not match.
Use one of the following procedures to set the character set for the application:
Setting in the "PGCLIENTENCODING" environment variable
Specifying the client_encoding parameter with the SET command
Also match the character code with the environment.
Example
An example of specifying when the character set of the client is UTF-8 (Bash)
> PGCLIENTENCODING=UTF8; export PGCLIENTENCODING
An example of specifying when the character set of the client is UTF-8
> set PGCLIENTENCODING=UTF8
Example
An example of specifying when the character set of the client is UTF-8
> SET client_encoding TO 'UTF8';
Note
Text may be garbled when outputting results to the command prompt. Review the font settings for the command prompt if this occurs.
See
Refer to "Character Set Support" in "Server Administration" in the PostgreSQL Documentation for information on the character sets that can be used.