EPUB | CHM | PDF

TPSQLDatabase.Properties.CharSet

Top Previous Next

To set client encoding for the connection.

Syntax:

property CharSet: string;

Description:

The character set support in PostgreSQL allows you to store text in a variety of character sets, including single-byte character sets such as the ISO 8859 series and multiple-byte character sets such as EUC (Extended Unix Code), Unicode, and Mule internal code. All character sets can be used transparently throughout the server. The default character set is selected while initializing your PostgreSQL database cluster. It can be overridden when you create a database. So you can have multiple databases each with a different character set.

Server Character Sets

Description

SQL_ASCII

ASCII

EUC_JP

Japanese EUC

EUC_CN

Chinese EUC

EUC_KR

Korean EUC

JOHAB

Korean EUC (Hangle base)

EUC_TW

Taiwan EUC

UNICODE

Unicode (UTF-8)

MULE_INTERNAL

Mule internal code

LATIN1

ISO 8859-1/ECMA 94 (Latin alphabet no.1)

LATIN2

ISO 8859-2/ECMA 94 (Latin alphabet no.2)

LATIN3

ISO 8859-3/ECMA 94 (Latin alphabet no.3)

LATIN4

ISO 8859-4/ECMA 94 (Latin alphabet no.4)

LATIN5

ISO 8859-9/ECMA 128 (Latin alphabet no.5)

LATIN6

ISO 8859-10/ECMA 144 (Latin alphabet no.6)

LATIN7

ISO 8859-13 (Latin alphabet no.7)

LATIN8

ISO 8859-14 (Latin alphabet no.8)

LATIN9

ISO 8859-15 (Latin alphabet no.9)

LATIN10

ISO 8859-16/ASRO SR 14111 (Latin alphabet no.10)

ISO_8859_5

ISO 8859-5/ECMA 113 (Latin/Cyrillic)

ISO_8859_6

ISO 8859-6/ECMA 114 (Latin/Arabic)

ISO_8859_7

ISO 8859-7/ECMA 118 (Latin/Greek)

ISO_8859_8

ISO 8859-8/ECMA 121 (Latin/Hebrew)

KOI8

KOI8-R(U)

ALT

Windows CP866

WIN874

Windows CP874 (Thai)

WIN1250

Windows CP1250

WIN

Windows CP1251

WIN1256

Windows CP1256 (Arabic)

TCVN

TCVN-5712/Windows CP1258 (Vietnamese)

Property contains empty string if TPSQLdatabase.Connected is False. Value of CharSet property will be not saved in form files. For every session you must specify CharSet value again.

Example:

This code will set UNICODE charset for session immediately after connect.

procedure TForm1.PSQLDatabase1AfterConnect(Sender: TObject);
begin
 PSQLDatabase1.CharSet := 'UNICODE';
end;

Before PostgreSQL 7.2, LATIN5 mistakenly meant ISO 8859-5. From 7.2 on, LATIN5 means ISO 8859-9. If you have a LATIN5 database created on 7.1 or earlier and want to migrate to 7.2 or later, you should be careful about this change.