Re: UTF-8 support

From: Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp>
To: jm(dot)poure(at)freesurf(dot)fr
Cc: pgsql-odbc(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org
Subject: Re: UTF-8 support
Date: 2001-09-23 23:58:22
Message-ID: 20010924085822Z.t-ishii@sra.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-odbc

> 1) UTF-8
> http://www.postgresql.org/idocs/index.php?app-psql.html explains
> "Anything contained in single quotes is furthermore subject to C-like
> substitutions for \n (new line), \t (tab), \digits, \0digits, and \0xdigits
> (the character with the given decimal, octal, or hexadecimal code)."
>
> To start, I would like to store/display a simple 'A' letter in psql, number
> 0041, with the following queries:
>
> > 'INSERT INTO TABLE table_name VALUES (column-name) VALUES ( ' \0041' );
> and then SELECT * FROM table_name. It does not work.
> > Or simply SELECT '\0041'; which does not return 'A'.

Try:

INSERT INTO TABLE table_name VALUES (column-name) VALUES ( ' \101' );

I don't know why the docs claim so, '\OCTAL_NUMBER' seems to work
anyway.

BTW, 'A' is not 041 in octal, it is 101.

> 2) Japanese coding
> Do you recommend EUC_JP or UNICODE for storing Japanese text in PostgreSQL?
> This is for use in PHP (both for input and display, no recode needed).

If you are going to use Japanese only, EUC_JP will take less storage
space. So, in general EUC_JP is recommended.

> 3) Is there a way to query available encodings in PostgreSQL for display in
> pgAdmin.
> Is it a planned feature in PostgreSQL 7.2? This would be nice if it existed.
> Example: function pg_available_encodings -> SQL-ASCII;UNICODE;EUC-JP etc...

Currently no. But it would be easy to implement such a function. What
comes in mind is:

pg_available_encodings([INTEGER how]) RETURNS setof TEXT

where how is

0(or omitted): returns all available encodings
1: returns encodings in backend
2: returns encodings in frontend

Comments?
--
Tatsuo Ishii

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alex Pilosov 2001-09-24 01:29:11 outer joins strangeness
Previous Message Kovacs Baldvin 2001-09-23 23:55:38 Bug?: Update on ancestor for a row of a child

Browse pgsql-odbc by date

  From Date Subject
Next Message Hiroshi Inoue 2001-09-24 00:25:07 Re: Status of ODBC driver managers on Unix
Previous Message Marc G. Fournier 2001-09-23 23:40:24 Re: New driver options in 7.01.0007