All pages
Powered by GitBook
1 of 1

Loading...

24.3. 字元集支援

PostgreSQL 中的字元集支援允許您將文字以各種字元集(也稱為編碼)儲存,包括單位元組字元集(如 ISO 8859 系列)和多位元組字元集,如 EUC(延伸 Unix 代碼), UTF-8 和 Mule 內部代碼。用戶端可以透通地使用所有支援的字元集,但有一些並不支援在伺服器中使用(即作為伺服器端編碼)。使用 initdb 初始化 PostgreSQL 資料庫叢集時,會選擇預設字元集。建立資料庫時可以覆寫它,因此您可以擁有多個資料庫,每個資料庫具有不同的字元集。

但是,一個重要的限制是每個資料庫的字元集必須與資料庫的 LC_CTYPE(字元分類)和 LC_COLLATE(字串排序順序)語言環境設定相容。對於 C 或 POSIX 語言環境,允許使用任何字元集,但對於其他 libc 提供的語言環境,只有一個字元集可以正常工作。(但在 Windows 上,UTF-8 編碼可以與任何語言環境一起使用。)如果您配置了 ICU 支援,ICU 提供的語言環境可以與大多數但不是所有伺服器端編碼一起使用。

24.3.1. 支援的字元集

Table 24.1 顯示了可在 PostgreSQL 中使用的字元集。

Table 24.1. PostgreSQL Character Sets

Name
Description
Language
Server?
ICU?
Bytes/Char
Aliases

並非所有用戶端 API 都支援所有列出的字元集。例如,PostgreSQL JDBC 驅動程式就不支援 MULE_INTERNAL,LATIN6,LATIN8 和 LATIN10。

SQL_ASCII 設定與其他設定的行為大不相同。當伺服器字元集是 SQL_ASCII 時,伺服器根據 ASCII 標準解譯位元組值 0-127,而位元組值 128-255 作為未解譯的字元。當設定為 SQL_ASCII 時,不會進行編碼轉換。因此,這個設定並不是使用特定編碼的宣告,而是對編碼的未知宣告。在大多數情況下,如果您使用任何非 ASCII 資料,使用 SQL_ASCII 設定是不明智的,因為 PostgreSQL 將無法透過轉換或驗證非 ASCII 字元來幫助您。

24.3.2. 設定字元集

initdb 定義 PostgreSQL 叢集的預設字元集(編碼)。例如,

將預設字元集設定為 EUC_JP(日本語的延伸 Unix 代碼)。如果您喜歡更長的選項字串,則可以使用 --encoding 而不是 -E。如果使用 -E 或 --encoding 選項,initdb 將嘗試根據指定的或預設的語言環境決定要使用的相對應編碼。

您可以在資料庫建立時指定非預設編碼,前提是該編碼與所選語言環境相容:

這將建立一個名為 korean 的資料庫,該資料庫使用字元集 EUC_KR 和語言環境 ko_KR。另一種方法是使用此 SQL 指令:

請注意,上述指令指定複製 template0 資料庫。複製任何其他資料庫時,無法更改原資料庫的編碼和語言環境設定,因為這可能會導致資料損壞。有關更多訊息,請參閱。

資料庫的編碼儲存在系統目錄 pg_database 中。您可以使用 psql -l 選項或 \l 指令查看。

注意 在大多數現代作業系統上,PostgreSQL 可以確定 LC_CTYPE 設定所隱含的字元集,並強制只使用相符合的資料庫編碼。在較舊的系統上,您有責任確保使用所選區域設定所需的編碼。此區域中的錯誤可能會導致與區域設定相關操作(如排序)的奇怪行為。

即使 LC_CTYPE 不是 C 或 POSIX,PostgreSQL 也允許超級使用者使用 SQL_ASCII 編碼建立資料庫。如上所述,SQL_ASCII 不強制儲存在資料庫中的資料具有任何特定編碼,因此這種選擇會帶來相依於語言環境的錯誤行為風險。不推薦使用這種設定組合,有一天可能會被禁止使用。

24.3.3. 伺服器和用戶端之間的自動字元集轉換

PostgreSQL 支援伺服器和用戶端之間針對某些字元集組合的自動字元集轉換。轉換訊息儲存在 pg_conversion 系統目錄中。PostgreSQL 帶有一些預先定義的轉換,如 所示。您可以使用 SQL 指令 CREATE CONVERSION 建立新的轉換。

Table 23.2. Client/Server Character Set Conversions

Server Character Set
Available Client Character Sets

要啟用自動字元集轉換,您必須告訴 PostgreSQL 您要在用戶端中使用的字元集(編碼)。有幾種方法可以實現此目的:

  • 在 psql 中使用 \encoding 指令。\encoding 允許您即時更改用戶端編碼。例如,要將編碼更改為 SJIS,請鍵入:

  • libpq()具有控制用戶端編碼的功能。

  • 使用 SET client_encoding TO。可以使用以下 SQL 指令設定用戶端編碼:

    您還可以使用標準 SQL 語法 SET NAMES 來達到此目的:

    要查詢目前用戶端編碼:

如果無法轉換特定字元 - 假設您為伺服器選擇了 EUC_JP 而為用戶端選擇了 LATIN1,並且回傳了一些在 LATIN1 中沒有表示的日文字元 - 回報錯誤。

如果用戶端字元集定義為 SQL_ASCII,則無論伺服器的字元集如何,都將停用編碼轉換。就像伺服器一樣,除非使用全 ASCII 資料,否則使用 SQL_ASCII 是不明智的。

24.3.4. Available Character Set Conversions

PostgreSQL allows conversion between any two character sets for which a conversion function is listed in the system catalog. PostgreSQL comes with some predefined conversions, as summarized in and shown in more detail in . You can create a new conversion using the SQL command . (To be used for automatic client/server conversions, a conversion must be marked as “default” for its character set pair.)

Table 24.2. Built-in Client/Server Character Set Conversions

Server Character Set
Available Client Character Sets

Table 24.3. All Built-in Character Set Conversions

24.3.5. 延伸閱讀

這些是開始學習各種編碼系統的好資源。

  • CJKV 訊息處理:中文,日文,韓文和越南文運算

    • 包含 EUC_JP,EUC_CN,EUC_KR,EUC_TW 的詳細說明。

EUC_CN

Extended UNIX Code-CN

Simplified Chinese

Yes

Yes

1-3

EUC_JP

Extended UNIX Code-JP

Japanese

Yes

Yes

1-3

EUC_JIS_2004

Extended UNIX Code-JP, JIS X 0213

Japanese

Yes

No

1-3

EUC_KR

Extended UNIX Code-KR

Korean

Yes

Yes

1-3

EUC_TW

Extended UNIX Code-TW

Traditional Chinese, Taiwanese

Yes

Yes

1-3

GB18030

National Standard

Chinese

No

No

1-4

GBK

Extended National Standard

Simplified Chinese

No

No

1-2

WIN936, Windows936

ISO_8859_5

ISO 8859-5, ECMA 113

Latin/Cyrillic

Yes

Yes

1

ISO_8859_6

ISO 8859-6, ECMA 114

Latin/Arabic

Yes

Yes

1

ISO_8859_7

ISO 8859-7, ECMA 118

Latin/Greek

Yes

Yes

1

ISO_8859_8

ISO 8859-8, ECMA 121

Latin/Hebrew

Yes

Yes

1

JOHAB

JOHAB

Korean (Hangul)

No

No

1-3

KOI8R

KOI8-R

Cyrillic (Russian)

Yes

Yes

1

KOI8

KOI8U

KOI8-U

Cyrillic (Ukrainian)

Yes

Yes

1

LATIN1

ISO 8859-1, ECMA 94

Western European

Yes

Yes

1

ISO88591

LATIN2

ISO 8859-2, ECMA 94

Central European

Yes

Yes

1

ISO88592

LATIN3

ISO 8859-3, ECMA 94

South European

Yes

Yes

1

ISO88593

LATIN4

ISO 8859-4, ECMA 94

North European

Yes

Yes

1

ISO88594

LATIN5

ISO 8859-9, ECMA 128

Turkish

Yes

Yes

1

ISO88599

LATIN6

ISO 8859-10, ECMA 144

Nordic

Yes

Yes

1

ISO885910

LATIN7

ISO 8859-13

Baltic

Yes

Yes

1

ISO885913

LATIN8

ISO 8859-14

Celtic

Yes

Yes

1

ISO885914

LATIN9

ISO 8859-15

LATIN1 with Euro and accents

Yes

Yes

1

ISO885915

LATIN10

ISO 8859-16, ASRO SR 14111

Romanian

Yes

No

1

ISO885916

MULE_INTERNAL

Mule internal code

Multilingual Emacs

Yes

No

1-4

SJIS

Shift JIS

Japanese

No

No

1-2

Mskanji, ShiftJIS, WIN932, Windows932

SHIFT_JIS_2004

Shift JIS, JIS X 0213

Japanese

No

No

1-2

SQL_ASCII

unspecified (see text)

any

Yes

No

1

UHC

Unified Hangul Code

Korean

No

No

1-2

WIN949, Windows949

UTF8

Unicode, 8-bit

all

Yes

Yes

1-4

Unicode

WIN866

Windows CP866

Cyrillic

Yes

Yes

1

ALT

WIN874

Windows CP874

Thai

Yes

No

1

WIN1250

Windows CP1250

Central European

Yes

Yes

1

WIN1251

Windows CP1251

Cyrillic

Yes

Yes

1

WIN

WIN1252

Windows CP1252

Western European

Yes

Yes

1

WIN1253

Windows CP1253

Greek

Yes

Yes

1

WIN1254

Windows CP1254

Turkish

Yes

Yes

1

WIN1255

Windows CP1255

Hebrew

Yes

Yes

1

WIN1256

Windows CP1256

Arabic

Yes

Yes

1

WIN1257

Windows CP1257

Baltic

Yes

Yes

1

WIN1258

Windows CP1258

Vietnamese

Yes

Yes

1

ABC, TCVN, TCVN5712, VSCII

GB18030

not supported as a server encoding

GBK

not supported as a server encoding

ISO_8859_5

ISO_8859_5, KOI8R, MULE_INTERNAL, UTF8, WIN866, WIN1251

ISO_8859_6

ISO_8859_6, UTF8

ISO_8859_7

ISO_8859_7, UTF8

ISO_8859_8

ISO_8859_8, UTF8

JOHAB

JOHAB, UTF8

KOI8R

KOI8R, ISO_8859_5, MULE_INTERNAL, UTF8, WIN866, WIN1251

KOI8U

KOI8U, UTF8

LATIN1

LATIN1, MULE_INTERNAL, UTF8

LATIN2

LATIN2, MULE_INTERNAL, UTF8, WIN1250

LATIN3

LATIN3, MULE_INTERNAL, UTF8

LATIN4

LATIN4, MULE_INTERNAL, UTF8

LATIN5

LATIN5, UTF8

LATIN6

LATIN6, UTF8

LATIN7

LATIN7, UTF8

LATIN8

LATIN8, UTF8

LATIN9

LATIN9, UTF8

LATIN10

LATIN10, UTF8

MULE_INTERNAL

MULE_INTERNAL, BIG5, EUC_CN, EUC_JP, EUC_KR, EUC_TW, ISO_8859_5, KOI8R, LATIN1 to LATIN4, SJIS, WIN866, WIN1250, WIN1251

SJIS

not supported as a server encoding

SQL_ASCII

any (no conversion will be performed)

UHC

not supported as a server encoding

UTF8

all supported encodings

WIN866

WIN866, ISO_8859_5, KOI8R, MULE_INTERNAL, UTF8, WIN1251

WIN874

WIN874, UTF8

WIN1250

WIN1250, LATIN2, MULE_INTERNAL, UTF8

WIN1251

WIN1251, ISO_8859_5, KOI8R, MULE_INTERNAL, UTF8, WIN866

WIN1252

WIN1252, UTF8

WIN1253

WIN1253, UTF8

WIN1254

WIN1254, UTF8

WIN1255

WIN1255, UTF8

WIN1256

WIN1256, UTF8

WIN1257

WIN1257, UTF8

WIN1258

WIN1258, UTF8

要回傳預設編碼:
  • 使用 PGCLIENTENCODING。如果在用戶端環境中定義了環境變數 PGCLIENTENCODING,則在建立與伺服器的連線時會自動選擇該用戶端編碼。(這可以隨後使用上面提到的任何其他方法覆蓋。)

  • 使用組態變數 client_encoding。如果設定了 client_encoding 變數,則在建立與伺服器的連線時會自動選擇該用戶端編碼。(這可以隨後使用上面提到的任何其他方法覆蓋。)

  • EUC_TW

    EUC_TW, BIG5, MULE_INTERNAL, UTF8

    GB18030

    not supported as a server encoding

    GBK

    not supported as a server encoding

    ISO_8859_5

    ISO_8859_5, KOI8R, MULE_INTERNAL, UTF8, WIN866, WIN1251

    ISO_8859_6

    ISO_8859_6, UTF8

    ISO_8859_7

    ISO_8859_7, UTF8

    ISO_8859_8

    ISO_8859_8, UTF8

    JOHAB

    not supported as a server encoding

    KOI8R

    KOI8R, ISO_8859_5, MULE_INTERNAL, UTF8, WIN866, WIN1251

    KOI8U

    KOI8U, UTF8

    LATIN1

    LATIN1, MULE_INTERNAL, UTF8

    LATIN2

    LATIN2, MULE_INTERNAL, UTF8, WIN1250

    LATIN3

    LATIN3, MULE_INTERNAL, UTF8

    LATIN4

    LATIN4, MULE_INTERNAL, UTF8

    LATIN5

    LATIN5, UTF8

    LATIN6

    LATIN6, UTF8

    LATIN7

    LATIN7, UTF8

    LATIN8

    LATIN8, UTF8

    LATIN9

    LATIN9, UTF8

    LATIN10

    LATIN10, UTF8

    MULE_INTERNAL

    MULE_INTERNAL, BIG5, EUC_CN, EUC_JP, EUC_KR, EUC_TW, ISO_8859_5, KOI8R, LATIN1 to LATIN4, SJIS, WIN866, WIN1250, WIN1251

    SJIS

    not supported as a server encoding

    SHIFT_JIS_2004

    not supported as a server encoding

    SQL_ASCII

    any (no conversion will be performed)

    UHC

    not supported as a server encoding

    UTF8

    all supported encodings

    WIN866

    WIN866, ISO_8859_5, KOI8R, MULE_INTERNAL, UTF8, WIN1251

    WIN874

    WIN874, UTF8

    WIN1250

    WIN1250, LATIN2, MULE_INTERNAL, UTF8

    WIN1251

    WIN1251, ISO_8859_5, KOI8R, MULE_INTERNAL, UTF8, WIN866

    WIN1252

    WIN1252, UTF8

    WIN1253

    WIN1253, UTF8

    WIN1254

    WIN1254, UTF8

    WIN1255

    WIN1255, UTF8

    WIN1256

    WIN1256, UTF8

    WIN1257

    WIN1257, UTF8

    WIN1258

    WIN1258, UTF8

    MULE_INTERNAL

    euc_cn_to_utf8

    EUC_CN

    UTF8

    euc_jp_to_mic

    EUC_JP

    MULE_INTERNAL

    euc_jp_to_sjis

    EUC_JP

    SJIS

    euc_jp_to_utf8

    EUC_JP

    UTF8

    euc_kr_to_mic

    EUC_KR

    MULE_INTERNAL

    euc_kr_to_utf8

    EUC_KR

    UTF8

    euc_tw_to_big5

    EUC_TW

    BIG5

    euc_tw_to_mic

    EUC_TW

    MULE_INTERNAL

    euc_tw_to_utf8

    EUC_TW

    UTF8

    gb18030_to_utf8

    GB18030

    UTF8

    gbk_to_utf8

    GBK

    UTF8

    iso_8859_10_to_utf8

    LATIN6

    UTF8

    iso_8859_13_to_utf8

    LATIN7

    UTF8

    iso_8859_14_to_utf8

    LATIN8

    UTF8

    iso_8859_15_to_utf8

    LATIN9

    UTF8

    iso_8859_16_to_utf8

    LATIN10

    UTF8

    iso_8859_1_to_mic

    LATIN1

    MULE_INTERNAL

    iso_8859_1_to_utf8

    LATIN1

    UTF8

    iso_8859_2_to_mic

    LATIN2

    MULE_INTERNAL

    iso_8859_2_to_utf8

    LATIN2

    UTF8

    iso_8859_2_to_windows_1250

    LATIN2

    WIN1250

    iso_8859_3_to_mic

    LATIN3

    MULE_INTERNAL

    iso_8859_3_to_utf8

    LATIN3

    UTF8

    iso_8859_4_to_mic

    LATIN4

    MULE_INTERNAL

    iso_8859_4_to_utf8

    LATIN4

    UTF8

    iso_8859_5_to_koi8_r

    ISO_8859_5

    KOI8R

    iso_8859_5_to_mic

    ISO_8859_5

    MULE_INTERNAL

    iso_8859_5_to_utf8

    ISO_8859_5

    UTF8

    iso_8859_5_to_windows_1251

    ISO_8859_5

    WIN1251

    iso_8859_5_to_windows_866

    ISO_8859_5

    WIN866

    iso_8859_6_to_utf8

    ISO_8859_6

    UTF8

    iso_8859_7_to_utf8

    ISO_8859_7

    UTF8

    iso_8859_8_to_utf8

    ISO_8859_8

    UTF8

    iso_8859_9_to_utf8

    LATIN5

    UTF8

    johab_to_utf8

    JOHAB

    UTF8

    koi8_r_to_iso_8859_5

    KOI8R

    ISO_8859_5

    koi8_r_to_mic

    KOI8R

    MULE_INTERNAL

    koi8_r_to_utf8

    KOI8R

    UTF8

    koi8_r_to_windows_1251

    KOI8R

    WIN1251

    koi8_r_to_windows_866

    KOI8R

    WIN866

    koi8_u_to_utf8

    KOI8U

    UTF8

    mic_to_big5

    MULE_INTERNAL

    BIG5

    mic_to_euc_cn

    MULE_INTERNAL

    EUC_CN

    mic_to_euc_jp

    MULE_INTERNAL

    EUC_JP

    mic_to_euc_kr

    MULE_INTERNAL

    EUC_KR

    mic_to_euc_tw

    MULE_INTERNAL

    EUC_TW

    mic_to_iso_8859_1

    MULE_INTERNAL

    LATIN1

    mic_to_iso_8859_2

    MULE_INTERNAL

    LATIN2

    mic_to_iso_8859_3

    MULE_INTERNAL

    LATIN3

    mic_to_iso_8859_4

    MULE_INTERNAL

    LATIN4

    mic_to_iso_8859_5

    MULE_INTERNAL

    ISO_8859_5

    mic_to_koi8_r

    MULE_INTERNAL

    KOI8R

    mic_to_sjis

    MULE_INTERNAL

    SJIS

    mic_to_windows_1250

    MULE_INTERNAL

    WIN1250

    mic_to_windows_1251

    MULE_INTERNAL

    WIN1251

    mic_to_windows_866

    MULE_INTERNAL

    WIN866

    sjis_to_euc_jp

    SJIS

    EUC_JP

    sjis_to_mic

    SJIS

    MULE_INTERNAL

    sjis_to_utf8

    SJIS

    UTF8

    windows_1258_to_utf8

    WIN1258

    UTF8

    uhc_to_utf8

    UHC

    UTF8

    utf8_to_big5

    UTF8

    BIG5

    utf8_to_euc_cn

    UTF8

    EUC_CN

    utf8_to_euc_jp

    UTF8

    EUC_JP

    utf8_to_euc_kr

    UTF8

    EUC_KR

    utf8_to_euc_tw

    UTF8

    EUC_TW

    utf8_to_gb18030

    UTF8

    GB18030

    utf8_to_gbk

    UTF8

    GBK

    utf8_to_iso_8859_1

    UTF8

    LATIN1

    utf8_to_iso_8859_10

    UTF8

    LATIN6

    utf8_to_iso_8859_13

    UTF8

    LATIN7

    utf8_to_iso_8859_14

    UTF8

    LATIN8

    utf8_to_iso_8859_15

    UTF8

    LATIN9

    utf8_to_iso_8859_16

    UTF8

    LATIN10

    utf8_to_iso_8859_2

    UTF8

    LATIN2

    utf8_to_iso_8859_3

    UTF8

    LATIN3

    utf8_to_iso_8859_4

    UTF8

    LATIN4

    utf8_to_iso_8859_5

    UTF8

    ISO_8859_5

    utf8_to_iso_8859_6

    UTF8

    ISO_8859_6

    utf8_to_iso_8859_7

    UTF8

    ISO_8859_7

    utf8_to_iso_8859_8

    UTF8

    ISO_8859_8

    utf8_to_iso_8859_9

    UTF8

    LATIN5

    utf8_to_johab

    UTF8

    JOHAB

    utf8_to_koi8_r

    UTF8

    KOI8R

    utf8_to_koi8_u

    UTF8

    KOI8U

    utf8_to_sjis

    UTF8

    SJIS

    utf8_to_windows_1258

    UTF8

    WIN1258

    utf8_to_uhc

    UTF8

    UHC

    utf8_to_windows_1250

    UTF8

    WIN1250

    utf8_to_windows_1251

    UTF8

    WIN1251

    utf8_to_windows_1252

    UTF8

    WIN1252

    utf8_to_windows_1253

    UTF8

    WIN1253

    utf8_to_windows_1254

    UTF8

    WIN1254

    utf8_to_windows_1255

    UTF8

    WIN1255

    utf8_to_windows_1256

    UTF8

    WIN1256

    utf8_to_windows_1257

    UTF8

    WIN1257

    utf8_to_windows_866

    UTF8

    WIN866

    utf8_to_windows_874

    UTF8

    WIN874

    windows_1250_to_iso_8859_2

    WIN1250

    LATIN2

    windows_1250_to_mic

    WIN1250

    MULE_INTERNAL

    windows_1250_to_utf8

    WIN1250

    UTF8

    windows_1251_to_iso_8859_5

    WIN1251

    ISO_8859_5

    windows_1251_to_koi8_r

    WIN1251

    KOI8R

    windows_1251_to_mic

    WIN1251

    MULE_INTERNAL

    windows_1251_to_utf8

    WIN1251

    UTF8

    windows_1251_to_windows_866

    WIN1251

    WIN866

    windows_1252_to_utf8

    WIN1252

    UTF8

    windows_1256_to_utf8

    WIN1256

    UTF8

    windows_866_to_iso_8859_5

    WIN866

    ISO_8859_5

    windows_866_to_koi8_r

    WIN866

    KOI8R

    windows_866_to_mic

    WIN866

    MULE_INTERNAL

    windows_866_to_utf8

    WIN866

    UTF8

    windows_866_to_windows_1251

    WIN866

    WIN

    windows_874_to_utf8

    WIN874

    UTF8

    euc_jis_2004_to_utf8

    EUC_JIS_2004

    UTF8

    utf8_to_euc_jis_2004

    UTF8

    EUC_JIS_2004

    shift_jis_2004_to_utf8

    SHIFT_JIS_2004

    UTF8

    utf8_to_shift_jis_2004

    UTF8

    SHIFT_JIS_2004

    euc_jis_2004_to_shift_jis_2004

    EUC_JIS_2004

    SHIFT_JIS_2004

    shift_jis_2004_to_euc_jis_2004

    SHIFT_JIS_2004

    EUC_JIS_2004

    The conversion names follow a standard naming scheme: The official name of the source encoding with all non-alphanumeric characters replaced by underscores, followed by _to_, followed by the similarly processed destination encoding name. Therefore, these names sometimes deviate from the customary encoding names shown in .

    Unicode Consortium 的網站。
  • RFC 3629

    • UTF-8 (8-bit UCS/Unicode Transformation Format) 定義在這裡

  • BIG5

    Big Five

    Traditional Chinese

    No

    No

    1-2

    BIG5

    not supported as a server encoding

    EUC_CN

    EUC_CN, MULE_INTERNAL, UTF8

    EUC_JP

    EUC_JP, MULE_INTERNAL, SJIS, UTF8

    EUC_KR

    EUC_KR, MULE_INTERNAL, UTF8

    EUC_TW

    EUC_TW, BIG5, MULE_INTERNAL, UTF8

    BIG5

    not supported as a server encoding

    EUC_CN

    EUC_CN, MULE_INTERNAL, UTF8

    EUC_JP

    EUC_JP, MULE_INTERNAL, SJIS, UTF8

    EUC_JIS_2004

    EUC_JIS_2004, SHIFT_JIS_2004, UTF8

    EUC_KR

    EUC_KR, MULE_INTERNAL, UTF8

    Conversion Name [a]

    Source Encoding

    Destination Encoding

    big5_to_euc_tw

    BIG5

    EUC_TW

    big5_to_mic

    BIG5

    MULE_INTERNAL

    big5_to_utf8

    BIG5

    UTF8

    euc_cn_to_mic

    第 22.3 節
    Table 23.2
    第 33.10 節
    pg_conversion
    Table 24.2
    Table 24.3
    CREATE CONVERSION
    http://www.unicode.org/

    WIN950, Windows950

    EUC_CN

    initdb -E EUC_JP
    createdb -E EUC_KR -T template0 --lc-collate=ko_KR.euckr --lc-ctype=ko_KR.euckr korean
    CREATE DATABASE korean WITH ENCODING 'EUC_KR' LC_COLLATE='ko_KR.euckr' LC_CTYPE='ko_KR.euckr' TEMPLATE=template0;
    $ psql -l
                                             List of databases
       Name    |  Owner   | Encoding  |  Collation  |    Ctype    |          Access Privileges          
    -----------+----------+-----------+-------------+-------------+-------------------------------------
     clocaledb | hlinnaka | SQL_ASCII | C           | C           | 
     englishdb | hlinnaka | UTF8      | en_GB.UTF8  | en_GB.UTF8  | 
     japanese  | hlinnaka | UTF8      | ja_JP.UTF8  | ja_JP.UTF8  | 
     korean    | hlinnaka | EUC_KR    | ko_KR.euckr | ko_KR.euckr | 
     postgres  | hlinnaka | UTF8      | fi_FI.UTF8  | fi_FI.UTF8  | 
     template0 | hlinnaka | UTF8      | fi_FI.UTF8  | fi_FI.UTF8  | {=c/hlinnaka,hlinnaka=CTc/hlinnaka}
     template1 | hlinnaka | UTF8      | fi_FI.UTF8  | fi_FI.UTF8  | {=c/hlinnaka,hlinnaka=CTc/hlinnaka}
    (7 rows)
    \encoding SJIS
    SET CLIENT_ENCODING TO 'value';
    SET NAMES 'value';
    SHOW client_encoding;
    RESET client_encoding;
    [a]
    Table 24.1