2001-01-09 17:54:11 +08:00
|
|
|
|
PostgreSQL 7.0.1 multi-byte (MB) support README May 20 2000
|
|
|
|
|
|
|
|
|
|
Tatsuo Ishii
|
|
|
|
|
ishii@postgresql.org
|
|
|
|
|
http://www.sra.co.jp/people/t-ishii/PostgreSQL/
|
|
|
|
|
|
|
|
|
|
[<5B><>] 1. <20>P<EFBFBD>¥ۤ<C2A5><DBA4>F<EFBFBD><46> (Tatsuo Ishii) <20><><EFBFBD><EFBFBD>!
|
|
|
|
|
2. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵL, <20><>Ķ<EFBFBD>Y<EFBFBD><59><EFBFBD><EFBFBD><EFBFBD>~, <20><><EFBFBD>p<EFBFBD><70> cch@cc.kmu.edu.tw
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
0. ²<><C2B2>
|
|
|
|
|
|
|
|
|
|
MB <20>䴩<EFBFBD>O<EFBFBD><4F><EFBFBD>F<EFBFBD><46> PostgreSQL <20><><EFBFBD>B<EFBFBD>z<EFBFBD>h<EFBFBD>줸<EFBFBD>զr<D5A6><72> (multi-byte character),
|
|
|
|
|
<EFBFBD>Ҧp: EUC (Extended Unix Code), Unicode (<28>Τ@<40>X) <20>M Mule internal code
|
|
|
|
|
(<28>h<EFBFBD><68><EFBFBD>y<EFBFBD><79><EFBFBD><EFBFBD><EFBFBD>X). <20>b MB <20><><EFBFBD>䴩<EFBFBD>U, <20>A<EFBFBD>i<EFBFBD>H<EFBFBD>b<EFBFBD><62><EFBFBD>W<EFBFBD><57><EFBFBD>ܦ<EFBFBD> (regexp), LIKE <20><>
|
|
|
|
|
<EFBFBD><EFBFBD><EFBFBD>L<EFBFBD>@<40>Ǩ禡<C7A8><E7A6A1><EFBFBD>ϥΦh<CEA6>줸<EFBFBD>զr<D5A6><72>. <20>w<EFBFBD>]<5D><><EFBFBD>s<EFBFBD>X<EFBFBD>t<E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ϥ<EFBFBD> 8 <20>줸<EFBFBD>r<EFBFBD><72><EFBFBD>ɵo<C9B5>{<7B>F
|
|
|
|
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>D, <20>гq<D0B3><71><EFBFBD><EFBFBD>)
|
|
|
|
|
|
|
|
|
|
1. <20>p<EFBFBD><70><EFBFBD>ϥ<EFBFBD>
|
|
|
|
|
|
|
|
|
|
<EFBFBD>sĶ PostgreSQL <20>e, <20><><EFBFBD><EFBFBD> configure <20>ɨϥ<C9A8> multibyte <20><><EFBFBD>ﶵ
|
|
|
|
|
|
|
|
|
|
% ./configure --enable-multibyte[=encoding_system]
|
|
|
|
|
% ./configure --enable-multibyte[=<3D>s<EFBFBD>X<EFBFBD>t<EFBFBD><74>]
|
|
|
|
|
|
|
|
|
|
<EFBFBD>䤤<EFBFBD><EFBFBD><EFBFBD>s<EFBFBD>X<EFBFBD>t<EFBFBD>Υi<EFBFBD>H<EFBFBD><EFBFBD><EFBFBD>w<EFBFBD><EFBFBD><EFBFBD>U<EFBFBD><EFBFBD><EFBFBD>䤤<EFBFBD><EFBFBD><EFBFBD>@:
|
|
|
|
|
|
|
|
|
|
SQL_ASCII ASCII
|
|
|
|
|
EUC_JP Japanese EUC
|
|
|
|
|
EUC_CN Chinese EUC
|
|
|
|
|
EUC_KR Korean EUC
|
|
|
|
|
EUC_TW Taiwan EUC
|
|
|
|
|
UNICODE Unicode(UTF-8)
|
|
|
|
|
MULE_INTERNAL Mule internal
|
|
|
|
|
LATIN1 ISO 8859-1 English and some European languages
|
|
|
|
|
LATIN2 ISO 8859-2 English and some European languages
|
|
|
|
|
LATIN3 ISO 8859-3 English and some European languages
|
|
|
|
|
LATIN4 ISO 8859-4 English and some European languages
|
|
|
|
|
LATIN5 ISO 8859-5 English and some European languages
|
|
|
|
|
KOI8 KOI8-R
|
|
|
|
|
WIN Windows CP1251
|
|
|
|
|
ALT Windows CP866
|
|
|
|
|
|
|
|
|
|
<EFBFBD>Ҧp:
|
|
|
|
|
|
|
|
|
|
% ./configure --enable-multibyte=EUC_JP
|
|
|
|
|
|
|
|
|
|
<EFBFBD>p<EFBFBD>G<EFBFBD>ٲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>w<EFBFBD>s<EFBFBD>X<EFBFBD>t<EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD>w<EFBFBD>]<5D>ȴN<C8B4>O SQL_ASCII.
|
|
|
|
|
|
|
|
|
|
2. <20>p<EFBFBD><70><EFBFBD>]<5D>w<EFBFBD>s<EFBFBD>X
|
|
|
|
|
|
|
|
|
|
initdb <20>R<EFBFBD>O<EFBFBD>w<EFBFBD>q PostgresSQL <20>w<EFBFBD>˫᪺<CBAB>w<EFBFBD>]<5D>s<EFBFBD>X, <20>Ҧp:
|
|
|
|
|
|
|
|
|
|
% initdb -E EUC_JP
|
|
|
|
|
|
|
|
|
|
<EFBFBD>N<EFBFBD>w<EFBFBD>]<5D><><EFBFBD>s<EFBFBD>X<EFBFBD>]<5D>w<EFBFBD><77> EUC_JP (Extended Unix Code for Japanese), <20>p<EFBFBD>G<EFBFBD>A<EFBFBD><41><EFBFBD>w
|
|
|
|
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>r<EFBFBD><EFBFBD>, <20>A<EFBFBD>]<5D>i<EFBFBD>H<EFBFBD><48> "--encoding" <20>Ӥ<EFBFBD><D3A4><EFBFBD> "-E". <20>p<EFBFBD>G<EFBFBD>S<EFBFBD><53><EFBFBD>ϥ<EFBFBD> -E <20><>
|
|
|
|
|
--encoding <20><><EFBFBD>ﶵ, <20><><EFBFBD><EFBFBD><EFBFBD>sö<73>ɪ<EFBFBD><C9AA>]<5D>w<EFBFBD>|<7C><><EFBFBD><EFBFBD><EFBFBD>w<EFBFBD>]<5D><>.
|
|
|
|
|
|
|
|
|
|
<EFBFBD>A<EFBFBD>i<EFBFBD>H<EFBFBD>إߨϥΤ<EFBFBD><EFBFBD>P<EFBFBD>s<EFBFBD>X<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ʈw:
|
|
|
|
|
|
|
|
|
|
% createdb -E EUC_KR korean
|
|
|
|
|
|
|
|
|
|
<EFBFBD>o<EFBFBD>өR<EFBFBD>O<EFBFBD>|<7C>إߤ@<40>ӥs<D3A5><73> "korean" <20><><EFBFBD><EFBFBD><EFBFBD>Ʈw, <20>Ө<EFBFBD><D3A8>ĥ<EFBFBD> EUC_KR <20>s<EFBFBD>X.
|
|
|
|
|
<EFBFBD>t<EFBFBD>~<7E><><EFBFBD>@<40>Ӥ<EFBFBD><D3A4>k, <20>O<EFBFBD>ϥ<EFBFBD> SQL <20>R<EFBFBD>O, <20>]<5D>i<EFBFBD>H<EFBFBD>F<EFBFBD><46><EFBFBD>P<EFBFBD>˪<EFBFBD><CBAA>ت<EFBFBD>:
|
|
|
|
|
|
|
|
|
|
CREATE DATABASE korean WITH ENCODING = 'EUC_KR';
|
|
|
|
|
|
|
|
|
|
<EFBFBD>b pg_database <20>t<EFBFBD>γW<CEB3><57><EFBFBD><EFBFBD> (system catalog) <20><><EFBFBD><EFBFBD><EFBFBD>@<40><> "encoding" <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
|
|
|
|
|
<EFBFBD>N<EFBFBD>O<EFBFBD>ΨӬ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>@<40>Ӹ<EFBFBD><D3B8>Ʈw<C6AE><77><EFBFBD>s<EFBFBD>X. <20>A<EFBFBD>i<EFBFBD>H<EFBFBD><48> psql -l <20>ζi<CEB6>J psql <20><><EFBFBD><EFBFBD> \l <20><>
|
|
|
|
|
<EFBFBD>R<EFBFBD>O<EFBFBD>Ӭd<EFBFBD>ݸ<EFBFBD><EFBFBD>Ʈw<EFBFBD>ĥΦ<EFBFBD><EFBFBD>ؽs<EFBFBD>X:
|
|
|
|
|
|
|
|
|
|
$ psql -l
|
|
|
|
|
List of databases
|
|
|
|
|
Database | Owner | Encoding
|
|
|
|
|
---------------+---------+---------------
|
|
|
|
|
euc_cn | t-ishii | EUC_CN
|
|
|
|
|
euc_jp | t-ishii | EUC_JP
|
|
|
|
|
euc_kr | t-ishii | EUC_KR
|
|
|
|
|
euc_tw | t-ishii | EUC_TW
|
|
|
|
|
mule_internal | t-ishii | MULE_INTERNAL
|
|
|
|
|
regression | t-ishii | SQL_ASCII
|
|
|
|
|
template1 | t-ishii | EUC_JP
|
|
|
|
|
test | t-ishii | EUC_JP
|
|
|
|
|
unicode | t-ishii | UNICODE
|
|
|
|
|
(9 rows)
|
|
|
|
|
|
|
|
|
|
3. <20>e<EFBFBD>ݻP<DDBB><50><EFBFBD>ݽs<DDBD>X<EFBFBD><58><EFBFBD>۰<EFBFBD><DBB0>ഫ
|
|
|
|
|
|
|
|
|
|
[<5B><>: <20>e<EFBFBD>ݪx<DDAA><78><EFBFBD>Ȥ<EFBFBD><C8A4>ݪ<EFBFBD><DDAA>{<7B><>, <20>i<EFBFBD><69><EFBFBD>O psql <20>R<EFBFBD>O<EFBFBD><4F>Ķ<EFBFBD><C4B6>, <20>αĥ<CEB1> libpq <20><> C
|
|
|
|
|
<EFBFBD>{<7B><>, Perl <20>{<7B><>, <20>Ϊ̬O<CCAC>z<EFBFBD>L ODBC <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ε{<7B><>. <20>ӫ<EFBFBD><D3AB>ݴN<DDB4>O<EFBFBD><4F> PostgreSQL
|
|
|
|
|
<EFBFBD><EFBFBD><EFBFBD>Ʈw<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>A<EFBFBD>{<7B><>]
|
|
|
|
|
|
|
|
|
|
PostgreSQL <20>䴩<EFBFBD>Y<EFBFBD>ǽs<C7BD>X<EFBFBD>b<EFBFBD>e<EFBFBD>ݻP<DDBB><50><EFBFBD>ݶ<EFBFBD><DDB6><EFBFBD><EFBFBD>۰<EFBFBD><DBB0>ഫ: [<5B><>: <20>o<EFBFBD>̩ҿת<D2BF><D7AA>۰<EFBFBD>
|
|
|
|
|
<EFBFBD>ഫ<EFBFBD>O<EFBFBD><EFBFBD><EFBFBD>A<EFBFBD>b<EFBFBD>e<EFBFBD>ݤΫ<EFBFBD><EFBFBD>ݩҫŧi<EFBFBD>ĥΪ<EFBFBD><EFBFBD>s<EFBFBD>X<EFBFBD><EFBFBD><EFBFBD>P, <20><><EFBFBD>u<EFBFBD>n PostgreSQL <20>䴩<EFBFBD>o
|
|
|
|
|
<EFBFBD><EFBFBD><EFBFBD>ؽs<EFBFBD>X<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ഫ, <20><><EFBFBD>|<7C><><EFBFBD>A<EFBFBD>b<EFBFBD>s<EFBFBD><73><EFBFBD>e<EFBFBD><65><EFBFBD>ഫ]
|
|
|
|
|
|
|
|
|
|
encoding of backend available encoding of frontend
|
|
|
|
|
--------------------------------------------------------------------
|
|
|
|
|
EUC_JP EUC_JP, SJIS
|
|
|
|
|
|
|
|
|
|
EUC_TW EUC_TW, BIG5
|
|
|
|
|
|
|
|
|
|
LATIN2 LATIN2, WIN1250
|
|
|
|
|
|
|
|
|
|
LATIN5 LATIN5, WIN, ALT
|
|
|
|
|
|
|
|
|
|
MULE_INTERNAL EUC_JP, SJIS, EUC_KR, EUC_CN,
|
|
|
|
|
EUC_TW, BIG5, LATIN1 to LATIN5,
|
|
|
|
|
WIN, ALT, WIN1250
|
|
|
|
|
|
|
|
|
|
<EFBFBD>b<EFBFBD>Ұʦ۰ʽs<EFBFBD>X<EFBFBD>ഫ<EFBFBD><EFBFBD><EFBFBD>e, <20>A<EFBFBD><41><EFBFBD><EFBFBD><EFBFBD>i<EFBFBD>D PostgreSQL <20>A<EFBFBD>n<EFBFBD>b<EFBFBD>e<EFBFBD>ݱĥΦ<C4A5><CEA6>ؽs<D8BD>X.
|
|
|
|
|
<EFBFBD><EFBFBD><EFBFBD>n<EFBFBD>X<EFBFBD>Ӥ<EFBFBD><EFBFBD>k<EFBFBD>i<EFBFBD>H<EFBFBD>F<EFBFBD><EFBFBD><EFBFBD>o<EFBFBD>ӥت<EFBFBD>:
|
|
|
|
|
|
|
|
|
|
o <20>b psql <20>R<EFBFBD>O<EFBFBD><4F>Ķ<EFBFBD><C4B6><EFBFBD><EFBFBD><EFBFBD>ϥ<EFBFBD> \encoding <20>o<EFBFBD>өR<D3A9>O
|
|
|
|
|
|
|
|
|
|
\encoding <20>o<EFBFBD>өR<D3A9>O<EFBFBD>i<EFBFBD>H<EFBFBD><48><EFBFBD>A<EFBFBD><41><EFBFBD>W<EFBFBD><57><EFBFBD><EFBFBD><EFBFBD>e<EFBFBD>ݽs<DDBD>X, <20>Ҧp, <20>A<EFBFBD>n<EFBFBD>N<EFBFBD>e<EFBFBD>ݽs<DDBD>X<EFBFBD><58><EFBFBD><EFBFBD><EFBFBD><EFBFBD> SJIS,
|
|
|
|
|
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Х<EFBFBD>:
|
|
|
|
|
|
|
|
|
|
\encoding SJIS
|
|
|
|
|
|
|
|
|
|
o <20>ϥ<EFBFBD> libpq [<5B><>: PostgreSQL <20><><EFBFBD>Ʈw<C6AE><77> C API <20>{<7B><><EFBFBD>w] <20><><EFBFBD>禡
|
|
|
|
|
|
|
|
|
|
psql <20><> \encoding <20>R<EFBFBD>O<EFBFBD><4F><EFBFBD><EFBFBD><EFBFBD>u<EFBFBD>O<EFBFBD>h<EFBFBD>I<EFBFBD>s PQsetClientEncoding() <20>o<EFBFBD>Ө禡<D3A8>ӹF<D3B9><46><EFBFBD>ت<EFBFBD>.
|
|
|
|
|
|
|
|
|
|
int PQsetClientEncoding(PGconn *conn, const char *encoding)
|
|
|
|
|
|
|
|
|
|
<EFBFBD>W<EFBFBD><EFBFBD><EFBFBD><EFBFBD> conn <20>o<EFBFBD>ӰѼƥN<C6A5><4E><EFBFBD>@<40>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD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|
|
|
|
|
|
char *pg_encoding_to_char(int encoding_id)
|
|
|
|
|
|
|
|
|
|
o <20>ϥ<EFBFBD> PGCLIENTENCODING <20>o<EFBFBD><6F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܼ<EFBFBD>
|
|
|
|
|
|
|
|
|
|
<EFBFBD>p<EFBFBD>G<EFBFBD>e<EFBFBD>ݩ<EFBFBD><EFBFBD>]<5D>w<EFBFBD>F PGCLIENTENCODING <20>o<EFBFBD>@<40><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܼ<EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݷ|<7C><><EFBFBD>s<EFBFBD>X<EFBFBD>۰<EFBFBD><DBB0>ഫ.
|
|
|
|
|
|
|
|
|
|
[<5B><>] PostgreSQL 7.0.0 ~ 7.0.3 <20><><EFBFBD><EFBFBD> bug -- <20><><EFBFBD>{<7B>o<EFBFBD><6F><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܼ<EFBFBD>
|
|
|
|
|
|
|
|
|
|
o <20>ϥ<EFBFBD> SET CLIENT_ENCODING TO <20>o<EFBFBD><6F> SQL <20><><EFBFBD>R<EFBFBD>O
|
|
|
|
|
|
|
|
|
|
<EFBFBD>n<EFBFBD>]<5D>w<EFBFBD>e<EFBFBD>ݪ<EFBFBD><DDAA>s<EFBFBD>X<EFBFBD>i<EFBFBD>H<EFBFBD>ΥH<CEA5>U<EFBFBD>o<EFBFBD><6F> SQL <20>R<EFBFBD>O:
|
|
|
|
|
|
|
|
|
|
SET CLIENT_ENCODING TO 'encoding';
|
|
|
|
|
|
|
|
|
|
<EFBFBD>A<EFBFBD>]<5D>i<EFBFBD>H<EFBFBD>ϥ<EFBFBD> SQL92 <20><><EFBFBD>y<EFBFBD>k "SET NAMES" <20>F<EFBFBD><46><EFBFBD>P<EFBFBD>˪<EFBFBD><CBAA>ت<EFBFBD>:
|
|
|
|
|
|
|
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BFBD><EFBFBD><EFBFBD>]<5D>A<EFBFBD>b<EFBFBD><62><EFBFBD>ݿ<EFBFBD><DDBF>ܤF EUC_JP <20>o<EFBFBD>ӽs<D3BD>X, <20>e<EFBFBD>ݨϥ<DDA8> LATIN1, (<28>Y<EFBFBD>Ǥ<EFBFBD><C7A4><EFBFBD><EFBFBD>r<EFBFBD><72><EFBFBD>L<EFBFBD>k<EFBFBD>ഫ<EFBFBD><E0B4AB>
|
|
|
|
|
LATIN1) <20>b<EFBFBD>o<EFBFBD>Ӫ<EFBFBD><D3AA>p<EFBFBD>U, <20>Y<EFBFBD>Ӧr<D3A6><72><EFBFBD>Y<EFBFBD><59><EFBFBD><EFBFBD><EFBFBD>ন LATIN1 <20>r<EFBFBD><72><EFBFBD><EFBFBD>, <20>N<EFBFBD>|<7C>Q<EFBFBD>ন<EFBFBD>H<EFBFBD>U<EFBFBD><55><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:
|
|
|
|
|
|
|
|
|
|
(<28>Q<EFBFBD><51><EFBFBD>i<EFBFBD><69><EFBFBD><EFBFBD>)
|
|
|
|
|
|
|
|
|
|
6. <20>ѦҸ<D1A6><D2B8><EFBFBD>
|
|
|
|
|
|
|
|
|
|
These are good sources to start learning various kind of encoding
|
|
|
|
|
systems.
|
|
|
|
|
|
|
|
|
|
ftp://ftp.ora.com/pub/examples/nutshell/ujip/doc/cjk.inf
|
|
|
|
|
Detailed explanations of EUC_JP, EUC_CN, EUC_KR, EUC_TW
|
|
|
|
|
appear in section 3.2.
|
|
|
|
|
|
|
|
|
|
Unicode: http://www.unicode.org/
|
|
|
|
|
The homepage of UNICODE.
|
|
|
|
|
|
2007-01-10 06:22:55 +08:00
|
|
|
|
RFC 3629
|
2001-01-09 17:54:11 +08:00
|
|
|
|
UTF-8 is defined here.
|
|
|
|
|
|
|
|
|
|
5. History
|
|
|
|
|
|
|
|
|
|
May 20, 2000
|
|
|
|
|
* SJIS UDC (NEC selection IBM kanji) support contributed
|
|
|
|
|
by Eiji Tokuya
|
|
|
|
|
* Changes above will appear in 7.0.1
|
|
|
|
|
|
|
|
|
|
Mar 22, 2000
|
|
|
|
|
* Add new libpq functions PQsetClientEncoding, PQclientEncoding
|
|
|
|
|
* ./configure --with-mb=EUC_JP
|
|
|
|
|
now deprecated. use
|
|
|
|
|
./configure --enable-multibyte=EUC_JP
|
|
|
|
|
instead
|
|
|
|
|
* Add SQL_ASCII regression test case
|
|
|
|
|
* Add SJIS User Defined Character (UDC) support
|
|
|
|
|
* All of above will appear in 7.0
|
|
|
|
|
|
|
|
|
|
July 11, 1999
|
|
|
|
|
* Add support for WIN1250 (Windows Czech) as a client encoding
|
|
|
|
|
(contributed by Pavel Behal)
|
|
|
|
|
* fix some compiler warnings (contributed by Tomoaki Nishiyama)
|
|
|
|
|
|
|
|
|
|
Mar 23, 1999
|
|
|
|
|
* Add support for KOI8(KOI8-R), WIN(CP1251), ALT(CP866)
|
|
|
|
|
(thanks Oleg Broytmann for testing)
|
|
|
|
|
* Fix problem with MB and locale
|
|
|
|
|
|
|
|
|
|
Jan 26, 1999
|
|
|
|
|
* Add support for Big5 for fronend encoding
|
|
|
|
|
(you need to create a database with EUC_TW to use Big5)
|
|
|
|
|
* Add regression test case for EUC_TW
|
|
|
|
|
(contributed by Jonah Kuo <jonahkuo@mail.ttn.com.tw>)
|
|
|
|
|
|
|
|
|
|
Dec 15, 1998
|
|
|
|
|
* Bugs related to SQL_ASCII support fixed
|
|
|
|
|
|
|
|
|
|
Nov 5, 1998
|
|
|
|
|
* 6.4 release. In this version, pg_database has "encoding"
|
|
|
|
|
column that represents the database encoding
|
|
|
|
|
|
|
|
|
|
Jul 22, 1998
|
|
|
|
|
* determine encoding at initdb/createdb rather than compile time
|
|
|
|
|
* support for PGCLIENTENCODING when issuing COPY command
|
|
|
|
|
* support for SQL92 syntax "SET NAMES"
|
|
|
|
|
* support for LATIN2-5
|
|
|
|
|
* add UNICODE regression test case
|
|
|
|
|
* new test suite for MB
|
|
|
|
|
* clean up source files
|
|
|
|
|
|
|
|
|
|
Jun 5, 1998
|
|
|
|
|
* add support for the encoding translation between the backend
|
|
|
|
|
and the frontend
|
|
|
|
|
* new command SET CLIENT_ENCODING etc. added
|
|
|
|
|
* add support for LATIN1 character set
|
|
|
|
|
* enhance 8 bit cleaness
|
|
|
|
|
|
|
|
|
|
April 21, 1998 some enhancements/fixes
|
|
|
|
|
* character_length(), position(), substring() are now aware of
|
|
|
|
|
multi-byte characters
|
|
|
|
|
* add octet_length()
|
|
|
|
|
* add --with-mb option to configure
|
|
|
|
|
* new regression tests for EUC_KR
|
|
|
|
|
(contributed by "Soonmyung. Hong" <hong@lunaris.hanmesoft.co.kr>)
|
|
|
|
|
* add some test cases to the EUC_JP regression test
|
|
|
|
|
* fix problem in regress/regress.sh in case of System V
|
|
|
|
|
* fix toupper(), tolower() to handle 8bit chars
|
|
|
|
|
|
|
|
|
|
Mar 25, 1998 MB PL2 is incorporated into PostgreSQL 6.3.1
|
|
|
|
|
|
|
|
|
|
Mar 10, 1998 PL2 released
|
|
|
|
|
* add regression test for EUC_JP, EUC_CN and MULE_INTERNAL
|
|
|
|
|
* add an English document (this file)
|
|
|
|
|
* fix problems concerning 8-bit single byte characters
|
|
|
|
|
|
|
|
|
|
Mar 1, 1998 PL1 released
|
|
|
|
|
|
|
|
|
|
Appendix:
|
|
|
|
|
|
|
|
|
|
[Here is a good documentation explaining how to use WIN1250 on
|
|
|
|
|
Windows/ODBC from Pavel Behal. Please note that Installation step 1)
|
|
|
|
|
is not necceary in 6.5.1 -- Tatsuo]
|
|
|
|
|
|
|
|
|
|
Version: 0.91 for PgSQL 6.5
|
|
|
|
|
Author: Pavel Behal
|
|
|
|
|
Revised by: Tatsuo Ishii
|
|
|
|
|
Email: behal@opf.slu.cz
|
|
|
|
|
Licence: The Same as PostgreSQL
|
|
|
|
|
|
|
|
|
|
Sorry for my Eglish and C code, I'm not native :-)
|
|
|
|
|
|
|
|
|
|
!!!!!!!!!!!!!!!!!!!!!!!!! NO WARRANTY !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
|
|
|
|
|
|
Instalation:
|
|
|
|
|
------------
|
|
|
|
|
1) Change three affected files in source directories
|
|
|
|
|
(I don't have time to create proper patch diffs, I don't know how)
|
|
|
|
|
2) Compile with enabled locale and multibyte set to LATIN2
|
|
|
|
|
3) Setup properly your instalation, do not forget to create locale
|
|
|
|
|
variables in your profile (environment). Ex. (may not be exactly true):
|
|
|
|
|
LC_ALL=cs_CZ.ISO8859-2
|
|
|
|
|
LC_COLLATE=cs_CZ.ISO8859-2
|
|
|
|
|
LC_CTYPE=cs_CZ.ISO8859-2
|
|
|
|
|
LC_MONETARY=cs_CZ.ISO8859-2
|
|
|
|
|
LC_NUMERIC=cs_CZ.ISO8859-2
|
|
|
|
|
LC_TIME=cs_CZ.ISO8859-2
|
|
|
|
|
4) You have to start the postmaster with locales set!
|
|
|
|
|
5) Try it with Czech language, it have to sort
|
|
|
|
|
5) Install ODBC driver for PgSQL into your M$ Windows
|
|
|
|
|
6) Setup properly your data source. Include this line in your ODBC
|
|
|
|
|
configuration dialog in field "Connect Settings:" :
|
|
|
|
|
SET CLIENT_ENCODING = 'WIN1250';
|
|
|
|
|
7) Now try it again, but in Windows with ODBC.
|
|
|
|
|
|
|
|
|
|
Description:
|
|
|
|
|
------------
|
|
|
|
|
- Depends on proper system locales, tested with RH6.0 and Slackware 3.6,
|
|
|
|
|
with cs_CZ.iso8859-2 loacle
|
|
|
|
|
- Never try to set-up server multibyte database encoding to WIN1250,
|
|
|
|
|
always use LATIN2 instead. There is not WIN1250 locale in Unix
|
|
|
|
|
- WIN1250 encoding is useable only for M$W ODBC clients. The characters are
|
|
|
|
|
on thy fly re-coded, to be displayed and stored back properly
|
|
|
|
|
|
|
|
|
|
Important:
|
|
|
|
|
----------
|
|
|
|
|
- it reorders your sort order depending on your LC_... setting, so don't be
|
|
|
|
|
confused with regression tests, they don't use locale
|
|
|
|
|
- "ch" is corectly sorted only in some newer locales (Ex. RH6.0)
|
|
|
|
|
- you have to insert money as '162,50' (with comma in aphostrophes!)
|
|
|
|
|
- not tested properly
|