Re: List of encodings

Peter J. Holzer <hjp-pgsql@hjp.at>

From: "Peter J. Holzer" <hjp-pgsql@hjp.at>
To: pgsql-general@lists.postgresql.org
Date: 2026-04-20T05:53:52Z
Lists: 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!"