encoding names v2. - Mailing list pgsql-patches

From Karel Zak
Subject encoding names v2.
Date
Msg-id 20010822151058.F17272@zf.jcu.cz
Whole thread Raw
Responses Re: encoding names v2.  (Peter Eisentraut <peter_e@gmx.net>)
Re: encoding names v2.  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-patches
 Hi,

 all are almost same as in last version of this patch. Here are new
changes:

 - aliases cyrillic, cp819, ibm819, isoir100x, l1-4 are removed
 - KOI8 is KOI8-R in *all* functions, maps, etc.
 - WIN is window-1251 (WIN1251)   --- // ---
 - ALT is ALT :-)
 - UNICODE is utf-8
 - PG_ prefix is used for all SQL_ASCII and the others
 - fixed bug with --enable-unicode-conversion

 - getdatabaseencoding() is compatible with old versions, but
   in the code is commented as deprecated.

 - getdbencoding() is new function that return correct encoding names

   test2=# select getdatabaseencoding(), getdbencoding();
   getdatabaseencoding | getdbencoding
   ---------------------+---------------
   LATIN2              | ISO-8859-2
   (1 row)

 - pg_encoding_to_char() and other routines return new names! Only
   for getdatabaseencoding() we keep back compatibility - needful for
   JDBC.

 - all encoding names use '-'. I hope we will never see a problem with
   it and some operator. Encoding names must be used as quoted string.

   Only for SQL_ASCII is used '_', because I see that JDBC has hardcoded
   "pg_encoding_to_char(1) = 'SQL_ASCII'" :-(((

 - the ./configure.in:
     * use new encoding names too for --enable-multibyte
     * define MULTIBYTE that handle default encoding id
     * define MULTIBYTE_NAME that handle default encoding name (neeful
       for initdb)

   Note: old code use same names for macros and for encoding names, but
         now it's in Makefile.global:

   MULTIBYTE         = PG_KOI8R        /* id */
   MULTIBYTE_NAME    = "KOI8-R"        /* name */

 - the backend's createdb() function check correct BE encoding (here was
   bug)

 - 'initdb' check if default template encoding is correct for backend DB.

    In the old code it's in initdb very hardcoded. I add to pg_encoding
    option '-b' that check if encoding is correct for backend DB (means
    encoding is not client only). It's better than
    if [ $MULTIBYTEID -gt 31 ]
                          ^^^^^^
    in scripts.

    For example (Big5 is client only encoding):

   $ pg_encoding Big5
   16
   $ pg_encoding -b Big5
   $

 - initdb use MULTIBYTE_NAME and "pg_encoding -b"

 - ODBC works with old and new names for Shift_JIS and Big5

 - the patch doesn't contain docs about encoding names... later :-)


 Note for CVS commit:

   following files are renamed:

src/utils/mb/Unicode/KOI8_to_utf8.map  --> src/utils/mb/Unicode/KOI8R_to_utf8.map
src/utils/mb/Unicode/WIN_to_utf8.map  --> src/utils/mb/Unicode/WIN1251_to_utf8.map
src/utils/mb/Unicode/utf8_to_KOI8.map --> src/utils/mb/Unicode/utf8_to_KOI8R.map
src/utils/mb/Unicode/utf8_to_WIN.map --> src/utils/mb/Unicode/utf8_to_WIN1251.map

   new file:

src/utils/mb/encname.c

    removed file:

src/utils/mb/common.c


  The patch doesn't contain large configure script, but only configure.in.
Please before "cvs commit" do autoconf!


 Thanks for all suggestion.

 New comments?

            Karel

--
 Karel Zak  <zakkr@zf.jcu.cz>
 http://home.zf.jcu.cz/~zakkr/

 C, PostgreSQL, PHP, WWW, http://docs.linux.cz, http://mape.jcu.cz

Attachment

pgsql-patches by date:

Previous
From: Barry Lind
Date:
Subject: patch for jdbc BigDecimal bug
Next
From: Bruce Momjian
Date:
Subject: Re: patch for jdbc BigDecimal bug