Re: List of encodings - Mailing list pgsql-general

From Peter J. Holzer
Subject Re: List of encodings
Date
Msg-id nczevu7hf7mmdcetcvzymtl5ttlcltba3vuwm36ubi3fmyrdir@ldi6iai6jzen
Whole thread
In response to Re: List of encodings  (Igor Korot <ikorot01@gmail.com>)
List pgsql-general
On 2026-04-19 20:13:29 -0500, Igor Korot wrote:
> So, let's say I chose "BIG5"".
>
> As stated the table contains:
>
>  big5_to_utf8                   | BIG5           | t
>  big5_to_euc_tw                 | BIG5           | t
>  big5_to_mic                    | BIG5           | t
>
> Since all 3 are default character sets, which one would be chosen?
> (in the context of CREATE DATABASE)

Note that the table contains *two* encodings (conforencoding and
contoencoding) for each conversion. If you look at both it becomes
clear:

hjp=> select conname,
        pg_encoding_to_char(conforencoding) as for_enc,
        pg_encoding_to_char(contoencoding) to_enc,
        condefault
      from pg_conversion
      where conname like 'big5%';
╔════════════════╤═════════╤═══════════════╤════════════╗
║    conname     │ for_enc │    to_enc     │ condefault ║
╟────────────────┼─────────┼───────────────┼────────────╢
║ big5_to_euc_tw │ BIG5    │ EUC_TW        │ t          ║
║ big5_to_mic    │ BIG5    │ MULE_INTERNAL │ t          ║
║ big5_to_utf8   │ BIG5    │ UTF8          │ t          ║
╚════════════════╧═════════╧═══════════════╧════════════╝
(3 rows)

If you need to convert from BIG5 to UTF8, big5_to_utf8 is the default
(and indeed only) conversion. If you need to convert from BIG5 to
EUC_TW, it's big5_to_euc_tw, etc.

        hjp


--
   _  | Peter J. Holzer    | Story must make more sense than reality.
|_|_) |                    |
| |   | hjp@hjp.at         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"

Attachment

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: List of encodings
Next
From: Dominique Devienne
Date:
Subject: Test cluster with high OIDs above the signed-int limit (2B+)