Commit e3d7de6b authored by Bruce Momjian's avatar Bruce Momjian

Rename canonical encodings, per Peter:

	UNICODE => UTF8
	ALT => WIN866
	WIN => WIN1251
	TCVN => WIN1258

The old codes continue to work.
parent c6ad5c2e
...@@ -299,7 +299,7 @@ o set client_encoding $B%3%^%s%I$r;H$&J}K!(B ...@@ -299,7 +299,7 @@ o set client_encoding $B%3%^%s%I$r;H$&J}K!(B
PostgreSQL$B$N(BCONVERT$B$H5!G=$O$[$H$s$IF1$8$G$9$,!$8F$S=P$77A<0$,0[$j$^(B PostgreSQL$B$N(BCONVERT$B$H5!G=$O$[$H$s$IF1$8$G$9$,!$8F$S=P$77A<0$,0[$j$^(B
$B$9!%(B $B$9!%(B
SELECT convert(text using euc_jp_to_utf_8) FROM unicode_tbl; SELECT convert(text using euc_jp_to_utf8) FROM unicode_tbl;
"using" $B$N8e$N0z?t$O!V%3%s%P!<%8%g%sL>!W$G$9!%$3$NNc$G$O!$(BEUC_JP $B$+(B "using" $B$N8e$N0z?t$O!V%3%s%P!<%8%g%sL>!W$G$9!%$3$NNc$G$O!$(BEUC_JP $B$+(B
$B$i(B UTF-8 $B$KJQ49$9$k%3%s%P!<%8%g%s$r;XDj$7$F$$$^$9!%Dj5A:Q$N%3%s%P!<(B $B$i(B UTF-8 $B$KJQ49$9$k%3%s%P!<%8%g%s$r;XDj$7$F$$$^$9!%Dj5A:Q$N%3%s%P!<(B
......
...@@ -215,7 +215,7 @@ Multi-Language Support ...@@ -215,7 +215,7 @@ Multi-Language Support
* Optimize locale to have minimal performance impact when not used * Optimize locale to have minimal performance impact when not used
* Support multiple simultaneous character sets, per SQL92 * Support multiple simultaneous character sets, per SQL92
* Improve Unicode combined character handling (?) * Improve UTF8 combined character handling (?)
* Add octet_length_server() and octet_length_client() * Add octet_length_server() and octet_length_client()
* Make octet_length_client() the same as octet_length()? * Make octet_length_client() the same as octet_length()?
......
This diff is collapsed.
This diff is collapsed.
<!-- <!--
$PostgreSQL: pgsql/doc/src/sgml/ref/alter_conversion.sgml,v 1.5 2004/06/25 21:55:50 tgl Exp $ $PostgreSQL: pgsql/doc/src/sgml/ref/alter_conversion.sgml,v 1.6 2005/03/07 04:30:51 momjian Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -72,18 +72,18 @@ ALTER CONVERSION <replaceable>name</replaceable> OWNER TO <replaceable>newowner< ...@@ -72,18 +72,18 @@ ALTER CONVERSION <replaceable>name</replaceable> OWNER TO <replaceable>newowner<
<title>Examples</title> <title>Examples</title>
<para> <para>
To rename the conversion <literal>iso_8859_1_to_utf_8</literal> to To rename the conversion <literal>iso_8859_1_to_utf8</literal> to
<literal>latin1_to_unicode</literal>: <literal>latin1_to_unicode</literal>:
<programlisting> <programlisting>
ALTER CONVERSION iso_8859_1_to_utf_8 RENAME TO latin1_to_unicode; ALTER CONVERSION iso_8859_1_to_utf8 RENAME TO latin1_to_unicode;
</programlisting> </programlisting>
</para> </para>
<para> <para>
To change the owner of the conversion <literal>iso_8859_1_to_utf_8</literal> to To change the owner of the conversion <literal>iso_8859_1_to_utf8</literal> to
<literal>joe</literal>: <literal>joe</literal>:
<programlisting> <programlisting>
ALTER CONVERSION iso_8859_1_to_utf_8 OWNER TO joe; ALTER CONVERSION iso_8859_1_to_utf8 OWNER TO joe;
</programlisting> </programlisting>
</para> </para>
</refsect1> </refsect1>
......
<!-- <!--
$PostgreSQL: pgsql/doc/src/sgml/ref/comment.sgml,v 1.26 2005/01/04 00:39:53 tgl Exp $ $PostgreSQL: pgsql/doc/src/sgml/ref/comment.sgml,v 1.27 2005/03/07 04:30:51 momjian Exp $
PostgreSQL documentation PostgreSQL documentation
--> -->
...@@ -195,7 +195,7 @@ COMMENT ON TABLE mytable IS NULL; ...@@ -195,7 +195,7 @@ COMMENT ON TABLE mytable IS NULL;
COMMENT ON AGGREGATE my_aggregate (double precision) IS 'Computes sample variance'; COMMENT ON AGGREGATE my_aggregate (double precision) IS 'Computes sample variance';
COMMENT ON CAST (text AS int4) IS 'Allow casts from text to int4'; COMMENT ON CAST (text AS int4) IS 'Allow casts from text to int4';
COMMENT ON COLUMN my_table.my_column IS 'Employee ID number'; COMMENT ON COLUMN my_table.my_column IS 'Employee ID number';
COMMENT ON CONVERSION my_conv IS 'Conversion to Unicode'; COMMENT ON CONVERSION my_conv IS 'Conversion to UTF8';
COMMENT ON DATABASE my_database IS 'Development Database'; COMMENT ON DATABASE my_database IS 'Development Database';
COMMENT ON DOMAIN my_domain IS 'Email Address Domain'; COMMENT ON DOMAIN my_domain IS 'Email Address Domain';
COMMENT ON FUNCTION my_function (timestamp) IS 'Returns Roman Numeral'; COMMENT ON FUNCTION my_function (timestamp) IS 'Returns Roman Numeral';
......
<!-- $PostgreSQL: pgsql/doc/src/sgml/ref/create_conversion.sgml,v 1.14 2003/11/29 19:51:38 pgsql Exp $ --> <!-- $PostgreSQL: pgsql/doc/src/sgml/ref/create_conversion.sgml,v 1.15 2005/03/07 04:30:51 momjian Exp $ -->
<refentry id="SQL-CREATECONVERSION"> <refentry id="SQL-CREATECONVERSION">
<refmeta> <refmeta>
...@@ -136,10 +136,10 @@ conv_proc( ...@@ -136,10 +136,10 @@ conv_proc(
<title>Examples</title> <title>Examples</title>
<para> <para>
To create a conversion from encoding <literal>UNICODE</literal> to To create a conversion from encoding <literal>UTF8</literal> to
<literal>LATIN1</literal> using <function>myfunc</>: <literal>LATIN1</literal> using <function>myfunc</>:
<programlisting> <programlisting>
CREATE CONVERSION myconv FOR 'UNICODE' TO 'LATIN1' FROM myfunc; CREATE CONVERSION myconv FOR 'UTF8' TO 'LATIN1' FROM myfunc;
</programlisting> </programlisting>
</para> </para>
</refsect1> </refsect1>
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/selfuncs.c,v 1.172 2005/03/06 22:15:04 tgl Exp $ * $PostgreSQL: pgsql/src/backend/utils/adt/selfuncs.c,v 1.173 2005/03/07 04:30:51 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -4035,7 +4035,7 @@ pattern_selectivity(Const *patt, Pattern_Type ptype) ...@@ -4035,7 +4035,7 @@ pattern_selectivity(Const *patt, Pattern_Type ptype)
* *
* NOTE: at present this assumes we are in the C locale, so that simple * NOTE: at present this assumes we are in the C locale, so that simple
* bytewise comparison applies. However, we might be in a multibyte * bytewise comparison applies. However, we might be in a multibyte
* encoding such as UTF-8, so we do have to watch out for generating * encoding such as UTF8, so we do have to watch out for generating
* invalid encoding sequences. * invalid encoding sequences.
*/ */
Const * Const *
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# #
# Copyright (c) 2001-2005, PostgreSQL Global Development Group # Copyright (c) 2001-2005, PostgreSQL Global Development Group
# #
# $PostgreSQL: pgsql/src/backend/utils/mb/Unicode/Makefile,v 1.8 2005/01/01 20:44:18 tgl Exp $ # $PostgreSQL: pgsql/src/backend/utils/mb/Unicode/Makefile,v 1.9 2005/03/07 04:30:52 momjian Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
...@@ -18,8 +18,8 @@ ISO8859MAPS=iso8859_2_to_utf8.map iso8859_3_to_utf8.map \ ...@@ -18,8 +18,8 @@ ISO8859MAPS=iso8859_2_to_utf8.map iso8859_3_to_utf8.map \
utf8_to_iso8859_4.map utf8_to_iso8859_5.map utf8_to_iso8859_4.map utf8_to_iso8859_5.map
CYRILLICMAPS=koi8r_to_utf8.map win1251_to_utf8.map alt_to_utf8.map\ CYRILLICMAPS=koi8r_to_utf8.map win1251_to_utf8.map win866_to_utf8.map\
utf8_to_koi8r.map utf8_to_win1251.map utf8_to_alt.map utf8_to_koi8r.map utf8_to_win1251.map utf8_to_win866.map
MAPS= $(ISO8859MAPS) $(CYRILLICMAPS)\ MAPS= $(ISO8859MAPS) $(CYRILLICMAPS)\
big5_to_utf8.map euc_cn_to_utf8.map euc_jp_to_utf8.map \ big5_to_utf8.map euc_cn_to_utf8.map euc_jp_to_utf8.map \
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# #
# Copyright (c) 2001-2005, PostgreSQL Global Development Group # Copyright (c) 2001-2005, PostgreSQL Global Development Group
# #
# $PostgreSQL: pgsql/src/backend/utils/mb/Unicode/UCS_to_8859.pl,v 1.7 2005/01/01 20:44:18 tgl Exp $ # $PostgreSQL: pgsql/src/backend/utils/mb/Unicode/UCS_to_8859.pl,v 1.8 2005/03/07 04:30:52 momjian Exp $
# #
# Generate UTF-8 <--> ISO8859 code conversion tables from # Generate UTF-8 <--> ISO8859 code conversion tables from
# map files provided by Unicode organization. # map files provided by Unicode organization.
...@@ -39,7 +39,7 @@ foreach $charset (@charsets) { ...@@ -39,7 +39,7 @@ foreach $charset (@charsets) {
if( $code >= 0x80){ if( $code >= 0x80){
$utf = &ucs2utf($ucs); $utf = &ucs2utf($ucs);
if( $array{ $utf } ne "" ){ if( $array{ $utf } ne "" ){
printf STDERR "Warning: duplicate unicode: %04x\n",$ucs; printf STDERR "Warning: duplicate UTF8: %04x\n",$ucs;
next; next;
} }
$count++; $count++;
...@@ -83,7 +83,7 @@ foreach $charset (@charsets) { ...@@ -83,7 +83,7 @@ foreach $charset (@charsets) {
if($code >= 0x80){ if($code >= 0x80){
$utf = &ucs2utf($ucs); $utf = &ucs2utf($ucs);
if( $array{ $utf } ne "" ){ if( $array{ $utf } ne "" ){
printf STDERR "Warning: duplicate unicode: %04x\n",$ucs; printf STDERR "Warning: duplicate UTF8: %04x\n",$ucs;
next; next;
} }
$count++; $count++;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# #
# Copyright (c) 2001-2005, PostgreSQL Global Development Group # Copyright (c) 2001-2005, PostgreSQL Global Development Group
# #
# $PostgreSQL: pgsql/src/backend/utils/mb/Unicode/UCS_to_BIG5.pl,v 1.6 2005/01/01 20:44:18 tgl Exp $ # $PostgreSQL: pgsql/src/backend/utils/mb/Unicode/UCS_to_BIG5.pl,v 1.7 2005/03/07 04:30:52 momjian Exp $
# #
# Generate UTF-8 <--> BIG5 code conversion tables from # Generate UTF-8 <--> BIG5 code conversion tables from
# map files provided by Unicode organization. # map files provided by Unicode organization.
...@@ -35,7 +35,7 @@ while( <FILE> ){ ...@@ -35,7 +35,7 @@ while( <FILE> ){
if( $code >= 0x80 && $ucs >= 0x0080 ){ if( $code >= 0x80 && $ucs >= 0x0080 ){
$utf = &ucs2utf($ucs); $utf = &ucs2utf($ucs);
if( $array{ $utf } ne "" ){ if( $array{ $utf } ne "" ){
printf STDERR "Warning: duplicate unicode: %04x\n",$ucs; printf STDERR "Warning: duplicate UTF8: %04x\n",$ucs;
next; next;
} }
$count++; $count++;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# #
# Copyright (c) 2001-2005, PostgreSQL Global Development Group # Copyright (c) 2001-2005, PostgreSQL Global Development Group
# #
# $PostgreSQL: pgsql/src/backend/utils/mb/Unicode/UCS_to_EUC_CN.pl,v 1.6 2005/01/01 20:44:18 tgl Exp $ # $PostgreSQL: pgsql/src/backend/utils/mb/Unicode/UCS_to_EUC_CN.pl,v 1.7 2005/03/07 04:30:52 momjian Exp $
# #
# Generate UTF-8 <--> EUC_CN code conversion tables from # Generate UTF-8 <--> EUC_CN code conversion tables from
# map files provided by Unicode organization. # map files provided by Unicode organization.
...@@ -35,7 +35,7 @@ while( <FILE> ){ ...@@ -35,7 +35,7 @@ while( <FILE> ){
if( $code >= 0x80 && $ucs >= 0x0080 ){ if( $code >= 0x80 && $ucs >= 0x0080 ){
$utf = &ucs2utf($ucs); $utf = &ucs2utf($ucs);
if( $array{ $utf } ne "" ){ if( $array{ $utf } ne "" ){
printf STDERR "Warning: duplicate unicode: %04x\n",$ucs; printf STDERR "Warning: duplicate UTF8: %04x\n",$ucs;
next; next;
} }
$count++; $count++;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# #
# Copyright (c) 2001-2005, PostgreSQL Global Development Group # Copyright (c) 2001-2005, PostgreSQL Global Development Group
# #
# $PostgreSQL: pgsql/src/backend/utils/mb/Unicode/UCS_to_EUC_JP.pl,v 1.6 2005/01/01 20:44:18 tgl Exp $ # $PostgreSQL: pgsql/src/backend/utils/mb/Unicode/UCS_to_EUC_JP.pl,v 1.7 2005/03/07 04:30:52 momjian Exp $
# #
# Generate UTF-8 <--> EUC_JP code conversion tables from # Generate UTF-8 <--> EUC_JP code conversion tables from
# map files provided by Unicode organization. # map files provided by Unicode organization.
...@@ -51,7 +51,7 @@ while( <FILE> ){ ...@@ -51,7 +51,7 @@ while( <FILE> ){
if( $code >= 0x80 && $ucs >= 0x0080 ){ if( $code >= 0x80 && $ucs >= 0x0080 ){
$utf = &ucs2utf($ucs); $utf = &ucs2utf($ucs);
if( $array{ $utf } ne "" ){ if( $array{ $utf } ne "" ){
printf STDERR "Warning: duplicate unicode: %04x\n",$ucs; printf STDERR "Warning: duplicate UTF8: %04x\n",$ucs;
next; next;
} }
$count++; $count++;
...@@ -80,7 +80,7 @@ while( <FILE> ){ ...@@ -80,7 +80,7 @@ while( <FILE> ){
if( $code >= 0x80 && $ucs >= 0x0080 ){ if( $code >= 0x80 && $ucs >= 0x0080 ){
$utf = &ucs2utf($ucs); $utf = &ucs2utf($ucs);
if( $array{ $utf } ne "" ){ if( $array{ $utf } ne "" ){
printf STDERR "Warning: duplicate unicode: %04x\n",$ucs; printf STDERR "Warning: duplicate UTF8: %04x\n",$ucs;
next; next;
} }
$count++; $count++;
...@@ -108,7 +108,7 @@ while( <FILE> ){ ...@@ -108,7 +108,7 @@ while( <FILE> ){
if( $code >= 0x80 && $ucs >= 0x0080 ){ if( $code >= 0x80 && $ucs >= 0x0080 ){
$utf = &ucs2utf($ucs); $utf = &ucs2utf($ucs);
if( $array{ $utf } ne "" ){ if( $array{ $utf } ne "" ){
printf STDERR "Warning: duplicate unicode: %04x\n",$ucs; printf STDERR "Warning: duplicate UTF8: %04x\n",$ucs;
next; next;
} }
$count++; $count++;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# #
# Copyright (c) 2001-2005, PostgreSQL Global Development Group # Copyright (c) 2001-2005, PostgreSQL Global Development Group
# #
# $PostgreSQL: pgsql/src/backend/utils/mb/Unicode/UCS_to_EUC_KR.pl,v 1.7 2005/01/01 20:44:18 tgl Exp $ # $PostgreSQL: pgsql/src/backend/utils/mb/Unicode/UCS_to_EUC_KR.pl,v 1.8 2005/03/07 04:30:52 momjian Exp $
# #
# Generate UTF-8 <--> EUC_KR code conversion tables from # Generate UTF-8 <--> EUC_KR code conversion tables from
# map files provided by Unicode organization. # map files provided by Unicode organization.
...@@ -35,7 +35,7 @@ while( <FILE> ){ ...@@ -35,7 +35,7 @@ while( <FILE> ){
if( $code >= 0x80 && $ucs >= 0x0080 ){ if( $code >= 0x80 && $ucs >= 0x0080 ){
$utf = &ucs2utf($ucs); $utf = &ucs2utf($ucs);
if( $array{ $utf } ne "" ){ if( $array{ $utf } ne "" ){
printf STDERR "Warning: duplicate unicode: %04x\n",$ucs; printf STDERR "Warning: duplicate UTF8: %04x\n",$ucs;
next; next;
} }
$count++; $count++;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# #
# Copyright (c) 2001-2005, PostgreSQL Global Development Group # Copyright (c) 2001-2005, PostgreSQL Global Development Group
# #
# $PostgreSQL: pgsql/src/backend/utils/mb/Unicode/UCS_to_EUC_TW.pl,v 1.6 2005/01/01 20:44:18 tgl Exp $ # $PostgreSQL: pgsql/src/backend/utils/mb/Unicode/UCS_to_EUC_TW.pl,v 1.7 2005/03/07 04:30:52 momjian Exp $
# #
# Generate UTF-8 <--> EUC_TW code conversion tables from # Generate UTF-8 <--> EUC_TW code conversion tables from
# map files provided by Unicode organization. # map files provided by Unicode organization.
...@@ -36,7 +36,7 @@ while( <FILE> ){ ...@@ -36,7 +36,7 @@ while( <FILE> ){
if( $code >= 0x80 && $ucs >= 0x0080 ){ if( $code >= 0x80 && $ucs >= 0x0080 ){
$utf = &ucs2utf($ucs); $utf = &ucs2utf($ucs);
if( $array{ $utf } ne "" ){ if( $array{ $utf } ne "" ){
printf STDERR "Warning: duplicate unicode: %04x\n",$ucs; printf STDERR "Warning: duplicate UTF8: %04x\n",$ucs;
next; next;
} }
$count++; $count++;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# #
# Copyright 2002 by Bill Huang # Copyright 2002 by Bill Huang
# #
# $PostgreSQL: pgsql/src/backend/utils/mb/Unicode/UCS_to_GB18030.pl,v 1.4 2003/11/29 22:40:01 pgsql Exp $ # $PostgreSQL: pgsql/src/backend/utils/mb/Unicode/UCS_to_GB18030.pl,v 1.5 2005/03/07 04:30:52 momjian Exp $
# #
# Generate UTF-8 <--> GB18030 code conversion tables from # Generate UTF-8 <--> GB18030 code conversion tables from
# map files provided by Unicode organization. # map files provided by Unicode organization.
...@@ -35,7 +35,7 @@ while( <FILE> ){ ...@@ -35,7 +35,7 @@ while( <FILE> ){
if( $code >= 0x80 && $ucs >= 0x0080 ){ if( $code >= 0x80 && $ucs >= 0x0080 ){
$utf = &ucs2utf($ucs); $utf = &ucs2utf($ucs);
if( $array{ $utf } ne "" ){ if( $array{ $utf } ne "" ){
printf STDERR "Warning: duplicate unicode: %04x\n",$ucs; printf STDERR "Warning: duplicate UTF8: %04x\n",$ucs;
next; next;
} }
$count++; $count++;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# #
# Copyright (c) 2001-2005, PostgreSQL Global Development Group # Copyright (c) 2001-2005, PostgreSQL Global Development Group
# #
# $PostgreSQL: pgsql/src/backend/utils/mb/Unicode/UCS_to_GBK.pl,v 1.5 2005/01/01 20:44:18 tgl Exp $ # $PostgreSQL: pgsql/src/backend/utils/mb/Unicode/UCS_to_GBK.pl,v 1.6 2005/03/07 04:30:52 momjian Exp $
# #
# #
# Generate UTF-8 <--> GBK code conversion tables from # Generate UTF-8 <--> GBK code conversion tables from
...@@ -36,7 +36,7 @@ while( <FILE> ){ ...@@ -36,7 +36,7 @@ while( <FILE> ){
if( $code >= 0x80 && $ucs >= 0x0080 ){ if( $code >= 0x80 && $ucs >= 0x0080 ){
$utf = &ucs2utf($ucs); $utf = &ucs2utf($ucs);
if( $array{ $utf } ne "" ){ if( $array{ $utf } ne "" ){
printf STDERR "Warning: duplicate unicode: %04x\n",$ucs; printf STDERR "Warning: duplicate UTF8: %04x\n",$ucs;
next; next;
} }
$count++; $count++;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# #
# Copyright (c) 2001-2005, PostgreSQL Global Development Group # Copyright (c) 2001-2005, PostgreSQL Global Development Group
# #
# $PostgreSQL: pgsql/src/backend/utils/mb/Unicode/UCS_to_JOHAB.pl,v 1.5 2005/01/01 20:44:18 tgl Exp $ # $PostgreSQL: pgsql/src/backend/utils/mb/Unicode/UCS_to_JOHAB.pl,v 1.6 2005/03/07 04:30:52 momjian Exp $
# #
# Generate UTF-8 <--> JOHAB code conversion tables from # Generate UTF-8 <--> JOHAB code conversion tables from
# map files provided by Unicode organization. # map files provided by Unicode organization.
...@@ -35,7 +35,7 @@ while( <FILE> ){ ...@@ -35,7 +35,7 @@ while( <FILE> ){
if( $code >= 0x80 && $ucs >= 0x0080 ){ if( $code >= 0x80 && $ucs >= 0x0080 ){
$utf = &ucs2utf($ucs); $utf = &ucs2utf($ucs);
if( $array{ $utf } ne "" ){ if( $array{ $utf } ne "" ){
printf STDERR "Warning: duplicate unicode: %04x\n",$ucs; printf STDERR "Warning: duplicate UTF8: %04x\n",$ucs;
next; next;
} }
$count++; $count++;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# #
# Copyright (c) 2001-2005, PostgreSQL Global Development Group # Copyright (c) 2001-2005, PostgreSQL Global Development Group
# #
# $PostgreSQL: pgsql/src/backend/utils/mb/Unicode/UCS_to_SJIS.pl,v 1.7 2005/01/01 20:44:18 tgl Exp $ # $PostgreSQL: pgsql/src/backend/utils/mb/Unicode/UCS_to_SJIS.pl,v 1.8 2005/03/07 04:30:52 momjian Exp $
# #
# Generate UTF-8 <--> SJIS code conversion tables from # Generate UTF-8 <--> SJIS code conversion tables from
# map files provided by Unicode organization. # map files provided by Unicode organization.
...@@ -52,7 +52,7 @@ while( <FILE> ){ ...@@ -52,7 +52,7 @@ while( <FILE> ){
|| (( $code >= 0x879a ) || (( $code >= 0x879a )
&& ( $code <= 0x879c ))) && ( $code <= 0x879c )))
{ {
printf STDERR "Warning: duplicate unicode : UCS=0x%04x SJIS=0x%04x\n",$ucs,$code; printf STDERR "Warning: duplicate UTF8 : UCS=0x%04x SJIS=0x%04x\n",$ucs,$code;
next; next;
} }
$count++; $count++;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# #
# Copyright (c) 2001-2005, PostgreSQL Global Development Group # Copyright (c) 2001-2005, PostgreSQL Global Development Group
# #
# $PostgreSQL: pgsql/src/backend/utils/mb/Unicode/UCS_to_UHC.pl,v 1.5 2005/01/01 20:44:18 tgl Exp $ # $PostgreSQL: pgsql/src/backend/utils/mb/Unicode/UCS_to_UHC.pl,v 1.6 2005/03/07 04:30:52 momjian Exp $
# #
# Generate UTF-8 <--> BIG5 code conversion tables from # Generate UTF-8 <--> BIG5 code conversion tables from
# map files provided by Unicode organization. # map files provided by Unicode organization.
...@@ -35,7 +35,7 @@ while( <FILE> ){ ...@@ -35,7 +35,7 @@ while( <FILE> ){
if( $code >= 0x80 && $ucs >= 0x0080 ){ if( $code >= 0x80 && $ucs >= 0x0080 ){
$utf = &ucs2utf($ucs); $utf = &ucs2utf($ucs);
if( $array{ $utf } ne "" ){ if( $array{ $utf } ne "" ){
printf STDERR "Warning: duplicate unicode: %04x\n",$ucs; printf STDERR "Warning: duplicate UTF8: %04x\n",$ucs;
next; next;
} }
$count++; $count++;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# #
# Copyright (c) 2001-2005, PostgreSQL Global Development Group # Copyright (c) 2001-2005, PostgreSQL Global Development Group
# #
# $PostgreSQL: pgsql/src/backend/utils/mb/Unicode/UCS_to_WIN874.pl,v 1.5 2005/01/01 20:44:18 tgl Exp $ # $PostgreSQL: pgsql/src/backend/utils/mb/Unicode/UCS_to_WIN874.pl,v 1.6 2005/03/07 04:30:52 momjian Exp $
# #
# Generate UTF-8 <--> WIN874 code conversion tables from # Generate UTF-8 <--> WIN874 code conversion tables from
# map files provided by Unicode organization. # map files provided by Unicode organization.
...@@ -35,7 +35,7 @@ while( <FILE> ){ ...@@ -35,7 +35,7 @@ while( <FILE> ){
if( $code >= 0x80 && $ucs >= 0x0080 ){ if( $code >= 0x80 && $ucs >= 0x0080 ){
$utf = &ucs2utf($ucs); $utf = &ucs2utf($ucs);
if( $array{ $utf } ne "" ){ if( $array{ $utf } ne "" ){
printf STDERR "Warning: duplicate unicode: %04x\n",$ucs; printf STDERR "Warning: duplicate UTF8: %04x\n",$ucs;
next; next;
} }
$count++; $count++;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# #
# Copyright (c) 2001-2005, PostgreSQL Global Development Group # Copyright (c) 2001-2005, PostgreSQL Global Development Group
# #
# $PostgreSQL: pgsql/src/backend/utils/mb/Unicode/UCS_to_WINX.pl,v 1.5 2005/01/01 20:44:18 tgl Exp $ # $PostgreSQL: pgsql/src/backend/utils/mb/Unicode/UCS_to_WINX.pl,v 1.6 2005/03/07 04:30:52 momjian Exp $
# #
# Generate UTF-8 <--> WINX code conversion tables from # Generate UTF-8 <--> WINX code conversion tables from
# map files provided by Unicode organization. # map files provided by Unicode organization.
...@@ -42,7 +42,7 @@ foreach $charset (@charsets) { ...@@ -42,7 +42,7 @@ foreach $charset (@charsets) {
if( $code >= 0x80){ if( $code >= 0x80){
$utf = &ucs2utf($ucs); $utf = &ucs2utf($ucs);
if( $array{ $utf } ne "" ){ if( $array{ $utf } ne "" ){
printf STDERR "Warning: duplicate unicode: %04x\n",$ucs; printf STDERR "Warning: duplicate UTF8: %04x\n",$ucs;
next; next;
} }
$count++; $count++;
...@@ -86,7 +86,7 @@ foreach $charset (@charsets) { ...@@ -86,7 +86,7 @@ foreach $charset (@charsets) {
if($code >= 0x80){ if($code >= 0x80){
$utf = &ucs2utf($ucs); $utf = &ucs2utf($ucs);
if( $array{ $utf } ne "" ){ if( $array{ $utf } ne "" ){
printf STDERR "Warning: duplicate unicode: %04x\n",$ucs; printf STDERR "Warning: duplicate UTF8: %04x\n",$ucs;
next; next;
} }
$count++; $count++;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# #
# Copyright (c) 2001-2005, PostgreSQL Global Development Group # Copyright (c) 2001-2005, PostgreSQL Global Development Group
# #
# $PostgreSQL: pgsql/src/backend/utils/mb/Unicode/UCS_to_cyrillic.pl,v 1.6 2005/01/01 20:44:18 tgl Exp $ # $PostgreSQL: pgsql/src/backend/utils/mb/Unicode/UCS_to_cyrillic.pl,v 1.7 2005/03/07 04:30:52 momjian Exp $
# #
# Generate UTF-8 <--> ISO8859 code conversion tables from # Generate UTF-8 <--> ISO8859 code conversion tables from
# map files provided by Unicode organization. # map files provided by Unicode organization.
...@@ -17,8 +17,8 @@ ...@@ -17,8 +17,8 @@
require "ucs2utf.pl"; require "ucs2utf.pl";
%filename = ('KOI8R'=>'koi8-r.txt', %filename = ('KOI8R'=>'koi8-r.txt',
'WIN1251'=>'cp1251.txt', 'WIN1251'=>'cp1251.txt',
'ALT'=>'cp866.txt'); 'WIN866'=>'cp866.txt');
@charsets = ('KOI8R','ALT','WIN1251'); @charsets = ('KOI8R','WIN866','WIN1251');
foreach $charset (@charsets) { foreach $charset (@charsets) {
# #
...@@ -41,7 +41,7 @@ foreach $charset (@charsets) { ...@@ -41,7 +41,7 @@ foreach $charset (@charsets) {
if( $code >= 0x80){ if( $code >= 0x80){
$utf = &ucs2utf($ucs); $utf = &ucs2utf($ucs);
if( $array{ $utf } ne "" ){ if( $array{ $utf } ne "" ){
printf STDERR "Warning: duplicate unicode: %04x\n",$ucs; printf STDERR "Warning: duplicate UTF8: %04x\n",$ucs;
next; next;
} }
$count++; $count++;
...@@ -85,7 +85,7 @@ foreach $charset (@charsets) { ...@@ -85,7 +85,7 @@ foreach $charset (@charsets) {
if($code >= 0x80){ if($code >= 0x80){
$utf = &ucs2utf($ucs); $utf = &ucs2utf($ucs);
if( $array{ $utf } ne "" ){ if( $array{ $utf } ne "" ){
printf STDERR "Warning: duplicate unicode: %04x\n",$ucs; printf STDERR "Warning: duplicate UTF8: %04x\n",$ucs;
next; next;
} }
$count++; $count++;
......
static pg_utf_to_local ULmapTCVN[ 120 ] = { static pg_utf_to_local ULmapWIN1258[ 120 ] = {
{0x0000, 0x0081}, {0x0000, 0x0081},
{0xc2a0, 0x00a0}, {0xc2a0, 0x00a0},
{0xc2a1, 0x00a1}, {0xc2a1, 0x00a1},
......
static pg_utf_to_local ULmap_ALT[ 128 ] = { static pg_utf_to_local ULmap_WIN866[ 128 ] = {
{0xc2a0, 0x00ff}, {0xc2a0, 0x00ff},
{0xc2a4, 0x00fd}, {0xc2a4, 0x00fd},
{0xc2b0, 0x00f8}, {0xc2b0, 0x00f8},
......
static pg_local_to_utf LUmapTCVN[ 128 ] = { static pg_local_to_utf LUmapWIN1258[ 128 ] = {
{0x0080, 0xe282ac}, {0x0080, 0xe282ac},
{0x0081, 0x0000}, {0x0081, 0x0000},
{0x0082, 0xe2809a}, {0x0082, 0xe2809a},
......
static pg_local_to_utf LUmapALT[ 128 ] = { static pg_local_to_utf LUmapWIN866[ 128 ] = {
{0x0080, 0xd090}, {0x0080, 0xd090},
{0x0081, 0xd091}, {0x0081, 0xd091},
{0x0082, 0xd092}, {0x0082, 0xd092},
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mb/conv.c,v 1.51 2004/12/31 22:01:42 pgsql Exp $ * $PostgreSQL: pgsql/src/backend/utils/mb/conv.c,v 1.52 2005/03/07 04:30:52 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -303,7 +303,7 @@ mic2latin_with_table( ...@@ -303,7 +303,7 @@ mic2latin_with_table(
/* /*
* comparison routine for bsearch() * comparison routine for bsearch()
* this routine is intended for UTF-8 -> local code * this routine is intended for UTF8 -> local code
*/ */
static int static int
compare1(const void *p1, const void *p2) compare1(const void *p1, const void *p2)
...@@ -318,7 +318,7 @@ compare1(const void *p1, const void *p2) ...@@ -318,7 +318,7 @@ compare1(const void *p1, const void *p2)
/* /*
* comparison routine for bsearch() * comparison routine for bsearch()
* this routine is intended for local code -> UTF-8 * this routine is intended for local code -> UTF8
*/ */
static int static int
compare2(const void *p1, const void *p2) compare2(const void *p1, const void *p2)
...@@ -332,9 +332,9 @@ compare2(const void *p1, const void *p2) ...@@ -332,9 +332,9 @@ compare2(const void *p1, const void *p2)
} }
/* /*
* UTF-8 ---> local code * UTF8 ---> local code
* *
* utf: input UTF-8 string. Its length is limited by "len" parameter * utf: input UTF8 string. Its length is limited by "len" parameter
* or a null terminator. * or a null terminator.
* iso: pointer to the output. * iso: pointer to the output.
* map: the conversion map. * map: the conversion map.
...@@ -373,7 +373,7 @@ UtfToLocal(unsigned char *utf, unsigned char *iso, ...@@ -373,7 +373,7 @@ UtfToLocal(unsigned char *utf, unsigned char *iso,
{ {
ereport(WARNING, ereport(WARNING,
(errcode(ERRCODE_UNTRANSLATABLE_CHARACTER), (errcode(ERRCODE_UNTRANSLATABLE_CHARACTER),
errmsg("ignoring unconvertible UTF-8 character 0x%04x", errmsg("ignoring unconvertible UTF8 character 0x%04x",
iutf))); iutf)));
continue; continue;
} }
...@@ -390,7 +390,7 @@ UtfToLocal(unsigned char *utf, unsigned char *iso, ...@@ -390,7 +390,7 @@ UtfToLocal(unsigned char *utf, unsigned char *iso,
} }
/* /*
* local code ---> UTF-8 * local code ---> UTF8
*/ */
void void
LocalToUtf(unsigned char *iso, unsigned char *utf, LocalToUtf(unsigned char *iso, unsigned char *utf,
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/cyrillic_and_mic/cyrillic_and_mic.c,v 1.9 2004/12/31 22:01:48 pgsql Exp $ * $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/cyrillic_and_mic/cyrillic_and_mic.c,v 1.10 2005/03/07 04:30:52 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -23,20 +23,20 @@ PG_FUNCTION_INFO_V1(iso_to_mic); ...@@ -23,20 +23,20 @@ PG_FUNCTION_INFO_V1(iso_to_mic);
PG_FUNCTION_INFO_V1(mic_to_iso); PG_FUNCTION_INFO_V1(mic_to_iso);
PG_FUNCTION_INFO_V1(win1251_to_mic); PG_FUNCTION_INFO_V1(win1251_to_mic);
PG_FUNCTION_INFO_V1(mic_to_win1251); PG_FUNCTION_INFO_V1(mic_to_win1251);
PG_FUNCTION_INFO_V1(alt_to_mic); PG_FUNCTION_INFO_V1(win866_to_mic);
PG_FUNCTION_INFO_V1(mic_to_alt); PG_FUNCTION_INFO_V1(mic_to_win866);
PG_FUNCTION_INFO_V1(koi8r_to_win1251); PG_FUNCTION_INFO_V1(koi8r_to_win1251);
PG_FUNCTION_INFO_V1(win1251_to_koi8r); PG_FUNCTION_INFO_V1(win1251_to_koi8r);
PG_FUNCTION_INFO_V1(koi8r_to_alt); PG_FUNCTION_INFO_V1(koi8r_to_win866);
PG_FUNCTION_INFO_V1(alt_to_koi8r); PG_FUNCTION_INFO_V1(win866_to_koi8r);
PG_FUNCTION_INFO_V1(alt_to_win1251); PG_FUNCTION_INFO_V1(win866_to_win1251);
PG_FUNCTION_INFO_V1(win1251_to_alt); PG_FUNCTION_INFO_V1(win1251_to_win866);
PG_FUNCTION_INFO_V1(iso_to_koi8r); PG_FUNCTION_INFO_V1(iso_to_koi8r);
PG_FUNCTION_INFO_V1(koi8r_to_iso); PG_FUNCTION_INFO_V1(koi8r_to_iso);
PG_FUNCTION_INFO_V1(iso_to_win1251); PG_FUNCTION_INFO_V1(iso_to_win1251);
PG_FUNCTION_INFO_V1(win1251_to_iso); PG_FUNCTION_INFO_V1(win1251_to_iso);
PG_FUNCTION_INFO_V1(iso_to_alt); PG_FUNCTION_INFO_V1(iso_to_win866);
PG_FUNCTION_INFO_V1(alt_to_iso); PG_FUNCTION_INFO_V1(win866_to_iso);
extern Datum koi8r_to_mic(PG_FUNCTION_ARGS); extern Datum koi8r_to_mic(PG_FUNCTION_ARGS);
extern Datum mic_to_koi8r(PG_FUNCTION_ARGS); extern Datum mic_to_koi8r(PG_FUNCTION_ARGS);
...@@ -44,20 +44,20 @@ extern Datum iso_to_mic(PG_FUNCTION_ARGS); ...@@ -44,20 +44,20 @@ extern Datum iso_to_mic(PG_FUNCTION_ARGS);
extern Datum mic_to_iso(PG_FUNCTION_ARGS); extern Datum mic_to_iso(PG_FUNCTION_ARGS);
extern Datum win1251_to_mic(PG_FUNCTION_ARGS); extern Datum win1251_to_mic(PG_FUNCTION_ARGS);
extern Datum mic_to_win1251(PG_FUNCTION_ARGS); extern Datum mic_to_win1251(PG_FUNCTION_ARGS);
extern Datum alt_to_mic(PG_FUNCTION_ARGS); extern Datum win866_to_mic(PG_FUNCTION_ARGS);
extern Datum mic_to_alt(PG_FUNCTION_ARGS); extern Datum mic_to_win866(PG_FUNCTION_ARGS);
extern Datum koi8r_to_win1251(PG_FUNCTION_ARGS); extern Datum koi8r_to_win1251(PG_FUNCTION_ARGS);
extern Datum win1251_to_koi8r(PG_FUNCTION_ARGS); extern Datum win1251_to_koi8r(PG_FUNCTION_ARGS);
extern Datum koi8r_to_alt(PG_FUNCTION_ARGS); extern Datum koi8r_to_win866(PG_FUNCTION_ARGS);
extern Datum alt_to_koi8r(PG_FUNCTION_ARGS); extern Datum win866_to_koi8r(PG_FUNCTION_ARGS);
extern Datum alt_to_win1251(PG_FUNCTION_ARGS); extern Datum win866_to_win1251(PG_FUNCTION_ARGS);
extern Datum win1251_to_alt(PG_FUNCTION_ARGS); extern Datum win1251_to_win866(PG_FUNCTION_ARGS);
extern Datum iso_to_koi8r(PG_FUNCTION_ARGS); extern Datum iso_to_koi8r(PG_FUNCTION_ARGS);
extern Datum koi8r_to_iso(PG_FUNCTION_ARGS); extern Datum koi8r_to_iso(PG_FUNCTION_ARGS);
extern Datum iso_to_win1251(PG_FUNCTION_ARGS); extern Datum iso_to_win1251(PG_FUNCTION_ARGS);
extern Datum win1251_to_iso(PG_FUNCTION_ARGS); extern Datum win1251_to_iso(PG_FUNCTION_ARGS);
extern Datum iso_to_alt(PG_FUNCTION_ARGS); extern Datum iso_to_win866(PG_FUNCTION_ARGS);
extern Datum alt_to_iso(PG_FUNCTION_ARGS); extern Datum win866_to_iso(PG_FUNCTION_ARGS);
/* ---------- /* ----------
* conv_proc( * conv_proc(
...@@ -76,8 +76,8 @@ static void iso2mic(unsigned char *l, unsigned char *p, int len); ...@@ -76,8 +76,8 @@ static void iso2mic(unsigned char *l, unsigned char *p, int len);
static void mic2iso(unsigned char *mic, unsigned char *p, int len); static void mic2iso(unsigned char *mic, unsigned char *p, int len);
static void win12512mic(unsigned char *l, unsigned char *p, int len); static void win12512mic(unsigned char *l, unsigned char *p, int len);
static void mic2win1251(unsigned char *mic, unsigned char *p, int len); static void mic2win1251(unsigned char *mic, unsigned char *p, int len);
static void alt2mic(unsigned char *l, unsigned char *p, int len); static void win8662mic(unsigned char *l, unsigned char *p, int len);
static void mic2alt(unsigned char *mic, unsigned char *p, int len); static void mic2win866(unsigned char *mic, unsigned char *p, int len);
Datum Datum
koi8r_to_mic(PG_FUNCTION_ARGS) koi8r_to_mic(PG_FUNCTION_ARGS)
...@@ -176,33 +176,33 @@ mic_to_win1251(PG_FUNCTION_ARGS) ...@@ -176,33 +176,33 @@ mic_to_win1251(PG_FUNCTION_ARGS)
} }
Datum Datum
alt_to_mic(PG_FUNCTION_ARGS) win866_to_mic(PG_FUNCTION_ARGS)
{ {
unsigned char *src = PG_GETARG_CSTRING(2); unsigned char *src = PG_GETARG_CSTRING(2);
unsigned char *dest = PG_GETARG_CSTRING(3); unsigned char *dest = PG_GETARG_CSTRING(3);
int len = PG_GETARG_INT32(4); int len = PG_GETARG_INT32(4);
Assert(PG_GETARG_INT32(0) == PG_ALT); Assert(PG_GETARG_INT32(0) == PG_WIN866);
Assert(PG_GETARG_INT32(1) == PG_MULE_INTERNAL); Assert(PG_GETARG_INT32(1) == PG_MULE_INTERNAL);
Assert(len >= 0); Assert(len >= 0);
alt2mic(src, dest, len); win8662mic(src, dest, len);
PG_RETURN_VOID(); PG_RETURN_VOID();
} }
Datum Datum
mic_to_alt(PG_FUNCTION_ARGS) mic_to_win866(PG_FUNCTION_ARGS)
{ {
unsigned char *src = PG_GETARG_CSTRING(2); unsigned char *src = PG_GETARG_CSTRING(2);
unsigned char *dest = PG_GETARG_CSTRING(3); unsigned char *dest = PG_GETARG_CSTRING(3);
int len = PG_GETARG_INT32(4); int len = PG_GETARG_INT32(4);
Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL); Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL);
Assert(PG_GETARG_INT32(1) == PG_ALT); Assert(PG_GETARG_INT32(1) == PG_WIN866);
Assert(len >= 0); Assert(len >= 0);
mic2alt(src, dest, len); mic2win866(src, dest, len);
PG_RETURN_VOID(); PG_RETURN_VOID();
} }
...@@ -248,7 +248,7 @@ win1251_to_koi8r(PG_FUNCTION_ARGS) ...@@ -248,7 +248,7 @@ win1251_to_koi8r(PG_FUNCTION_ARGS)
} }
Datum Datum
koi8r_to_alt(PG_FUNCTION_ARGS) koi8r_to_win866(PG_FUNCTION_ARGS)
{ {
unsigned char *src = PG_GETARG_CSTRING(2); unsigned char *src = PG_GETARG_CSTRING(2);
unsigned char *dest = PG_GETARG_CSTRING(3); unsigned char *dest = PG_GETARG_CSTRING(3);
...@@ -256,31 +256,31 @@ koi8r_to_alt(PG_FUNCTION_ARGS) ...@@ -256,31 +256,31 @@ koi8r_to_alt(PG_FUNCTION_ARGS)
unsigned char *buf; unsigned char *buf;
Assert(PG_GETARG_INT32(0) == PG_KOI8R); Assert(PG_GETARG_INT32(0) == PG_KOI8R);
Assert(PG_GETARG_INT32(1) == PG_ALT); Assert(PG_GETARG_INT32(1) == PG_WIN866);
Assert(len >= 0); Assert(len >= 0);
buf = palloc(len * ENCODING_GROWTH_RATE); buf = palloc(len * ENCODING_GROWTH_RATE);
koi8r2mic(src, buf, len); koi8r2mic(src, buf, len);
mic2alt(buf, dest, strlen(buf)); mic2win866(buf, dest, strlen(buf));
pfree(buf); pfree(buf);
PG_RETURN_VOID(); PG_RETURN_VOID();
} }
Datum Datum
alt_to_koi8r(PG_FUNCTION_ARGS) win866_to_koi8r(PG_FUNCTION_ARGS)
{ {
unsigned char *src = PG_GETARG_CSTRING(2); unsigned char *src = PG_GETARG_CSTRING(2);
unsigned char *dest = PG_GETARG_CSTRING(3); unsigned char *dest = PG_GETARG_CSTRING(3);
int len = PG_GETARG_INT32(4); int len = PG_GETARG_INT32(4);
unsigned char *buf; unsigned char *buf;
Assert(PG_GETARG_INT32(0) == PG_ALT); Assert(PG_GETARG_INT32(0) == PG_WIN866);
Assert(PG_GETARG_INT32(1) == PG_KOI8R); Assert(PG_GETARG_INT32(1) == PG_KOI8R);
Assert(len >= 0); Assert(len >= 0);
buf = palloc(len * ENCODING_GROWTH_RATE); buf = palloc(len * ENCODING_GROWTH_RATE);
alt2mic(src, buf, len); win8662mic(src, buf, len);
mic2koi8r(buf, dest, strlen(buf)); mic2koi8r(buf, dest, strlen(buf));
pfree(buf); pfree(buf);
...@@ -288,19 +288,19 @@ alt_to_koi8r(PG_FUNCTION_ARGS) ...@@ -288,19 +288,19 @@ alt_to_koi8r(PG_FUNCTION_ARGS)
} }
Datum Datum
alt_to_win1251(PG_FUNCTION_ARGS) win866_to_win1251(PG_FUNCTION_ARGS)
{ {
unsigned char *src = PG_GETARG_CSTRING(2); unsigned char *src = PG_GETARG_CSTRING(2);
unsigned char *dest = PG_GETARG_CSTRING(3); unsigned char *dest = PG_GETARG_CSTRING(3);
int len = PG_GETARG_INT32(4); int len = PG_GETARG_INT32(4);
unsigned char *buf; unsigned char *buf;
Assert(PG_GETARG_INT32(0) == PG_ALT); Assert(PG_GETARG_INT32(0) == PG_WIN866);
Assert(PG_GETARG_INT32(1) == PG_WIN1251); Assert(PG_GETARG_INT32(1) == PG_WIN1251);
Assert(len >= 0); Assert(len >= 0);
buf = palloc(len * ENCODING_GROWTH_RATE); buf = palloc(len * ENCODING_GROWTH_RATE);
alt2mic(src, buf, len); win8662mic(src, buf, len);
mic2win1251(buf, dest, strlen(buf)); mic2win1251(buf, dest, strlen(buf));
pfree(buf); pfree(buf);
...@@ -308,7 +308,7 @@ alt_to_win1251(PG_FUNCTION_ARGS) ...@@ -308,7 +308,7 @@ alt_to_win1251(PG_FUNCTION_ARGS)
} }
Datum Datum
win1251_to_alt(PG_FUNCTION_ARGS) win1251_to_win866(PG_FUNCTION_ARGS)
{ {
unsigned char *src = PG_GETARG_CSTRING(2); unsigned char *src = PG_GETARG_CSTRING(2);
unsigned char *dest = PG_GETARG_CSTRING(3); unsigned char *dest = PG_GETARG_CSTRING(3);
...@@ -316,12 +316,12 @@ win1251_to_alt(PG_FUNCTION_ARGS) ...@@ -316,12 +316,12 @@ win1251_to_alt(PG_FUNCTION_ARGS)
unsigned char *buf; unsigned char *buf;
Assert(PG_GETARG_INT32(0) == PG_WIN1251); Assert(PG_GETARG_INT32(0) == PG_WIN1251);
Assert(PG_GETARG_INT32(1) == PG_ALT); Assert(PG_GETARG_INT32(1) == PG_WIN866);
Assert(len >= 0); Assert(len >= 0);
buf = palloc(len * ENCODING_GROWTH_RATE); buf = palloc(len * ENCODING_GROWTH_RATE);
win12512mic(src, buf, len); win12512mic(src, buf, len);
mic2alt(buf, dest, strlen(buf)); mic2win866(buf, dest, strlen(buf));
pfree(buf); pfree(buf);
PG_RETURN_VOID(); PG_RETURN_VOID();
...@@ -408,7 +408,7 @@ win1251_to_iso(PG_FUNCTION_ARGS) ...@@ -408,7 +408,7 @@ win1251_to_iso(PG_FUNCTION_ARGS)
} }
Datum Datum
iso_to_alt(PG_FUNCTION_ARGS) iso_to_win866(PG_FUNCTION_ARGS)
{ {
unsigned char *src = PG_GETARG_CSTRING(2); unsigned char *src = PG_GETARG_CSTRING(2);
unsigned char *dest = PG_GETARG_CSTRING(3); unsigned char *dest = PG_GETARG_CSTRING(3);
...@@ -416,32 +416,32 @@ iso_to_alt(PG_FUNCTION_ARGS) ...@@ -416,32 +416,32 @@ iso_to_alt(PG_FUNCTION_ARGS)
unsigned char *buf; unsigned char *buf;
Assert(PG_GETARG_INT32(0) == PG_ISO_8859_5); Assert(PG_GETARG_INT32(0) == PG_ISO_8859_5);
Assert(PG_GETARG_INT32(1) == PG_ALT); Assert(PG_GETARG_INT32(1) == PG_WIN866);
Assert(len >= 0); Assert(len >= 0);
buf = palloc(len * ENCODING_GROWTH_RATE); buf = palloc(len * ENCODING_GROWTH_RATE);
iso2mic(src, buf, len); iso2mic(src, buf, len);
mic2alt(buf, dest, strlen(buf)); mic2win866(buf, dest, strlen(buf));
pfree(buf); pfree(buf);
PG_RETURN_VOID(); PG_RETURN_VOID();
} }
Datum Datum
alt_to_iso(PG_FUNCTION_ARGS) win866_to_iso(PG_FUNCTION_ARGS)
{ {
unsigned char *src = PG_GETARG_CSTRING(2); unsigned char *src = PG_GETARG_CSTRING(2);
unsigned char *dest = PG_GETARG_CSTRING(3); unsigned char *dest = PG_GETARG_CSTRING(3);
int len = PG_GETARG_INT32(4); int len = PG_GETARG_INT32(4);
unsigned char *buf; unsigned char *buf;
Assert(PG_GETARG_INT32(0) == PG_ALT); Assert(PG_GETARG_INT32(0) == PG_WIN866);
Assert(PG_GETARG_INT32(1) == PG_ISO_8859_5); Assert(PG_GETARG_INT32(1) == PG_ISO_8859_5);
Assert(len >= 0); Assert(len >= 0);
buf = palloc(len * ENCODING_GROWTH_RATE); buf = palloc(len * ENCODING_GROWTH_RATE);
alt2mic(src, buf, len); win8662mic(src, buf, len);
mic2alt(buf, dest, strlen(buf)); mic2win866(buf, dest, strlen(buf));
pfree(buf); pfree(buf);
PG_RETURN_VOID(); PG_RETURN_VOID();
...@@ -576,11 +576,11 @@ mic2win1251(unsigned char *mic, unsigned char *p, int len) ...@@ -576,11 +576,11 @@ mic2win1251(unsigned char *mic, unsigned char *p, int len)
mic2latin_with_table(mic, p, len, LC_KOI8_R, koi2win); mic2latin_with_table(mic, p, len, LC_KOI8_R, koi2win);
} }
/* alt2mic: CP866 to Mule internal code */ /* win8662mic: CP866 to Mule internal code */
static void static void
alt2mic(unsigned char *l, unsigned char *p, int len) win8662mic(unsigned char *l, unsigned char *p, int len)
{ {
static unsigned char alt2koi[] = { static unsigned char win8662koi[] = {
0xe1, 0xe2, 0xf7, 0xe7, 0xe4, 0xe5, 0xf6, 0xfa, 0xe1, 0xe2, 0xf7, 0xe7, 0xe4, 0xe5, 0xf6, 0xfa,
0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0,
0xf2, 0xf3, 0xf4, 0xf5, 0xe6, 0xe8, 0xe3, 0xfe, 0xf2, 0xf3, 0xf4, 0xf5, 0xe6, 0xe8, 0xe3, 0xfe,
...@@ -599,14 +599,14 @@ alt2mic(unsigned char *l, unsigned char *p, int len) ...@@ -599,14 +599,14 @@ alt2mic(unsigned char *l, unsigned char *p, int len)
0xb6, 0xa6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 0xb6, 0xa6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
}; };
latin2mic_with_table(l, p, len, LC_KOI8_R, alt2koi); latin2mic_with_table(l, p, len, LC_KOI8_R, win8662koi);
} }
/* mic2alt: Mule internal code to CP866 */ /* mic2win866: Mule internal code to CP866 */
static void static void
mic2alt(unsigned char *mic, unsigned char *p, int len) mic2win866(unsigned char *mic, unsigned char *p, int len)
{ {
static unsigned char koi2alt[] = { static unsigned char koi2win866[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
...@@ -625,5 +625,5 @@ mic2alt(unsigned char *mic, unsigned char *p, int len) ...@@ -625,5 +625,5 @@ mic2alt(unsigned char *mic, unsigned char *p, int len)
0x9c, 0x9b, 0x87, 0x98, 0x9d, 0x99, 0x97, 0x9a 0x9c, 0x9b, 0x87, 0x98, 0x9d, 0x99, 0x97, 0x9a
}; };
mic2latin_with_table(mic, p, len, LC_KOI8_R, koi2alt); mic2latin_with_table(mic, p, len, LC_KOI8_R, koi2win866);
} }
...@@ -3,19 +3,19 @@ ...@@ -3,19 +3,19 @@
-- --
CREATE USER conversion_test_user WITH NOCREATEDB NOCREATEUSER; CREATE USER conversion_test_user WITH NOCREATEDB NOCREATEUSER;
SET SESSION AUTHORIZATION conversion_test_user; SET SESSION AUTHORIZATION conversion_test_user;
CREATE CONVERSION myconv FOR 'LATIN1' TO 'UNICODE' FROM iso8859_1_to_utf8; CREATE CONVERSION myconv FOR 'LATIN1' TO 'UTF8' FROM iso8859_1_to_utf8;
-- --
-- cannot make same name conversion in same schema -- cannot make same name conversion in same schema
-- --
CREATE CONVERSION myconv FOR 'LATIN1' TO 'UNICODE' FROM iso8859_1_to_utf8; CREATE CONVERSION myconv FOR 'LATIN1' TO 'UTF8' FROM iso8859_1_to_utf8;
-- --
-- create default conversion with qualified name -- create default conversion with qualified name
-- --
CREATE DEFAULT CONVERSION public.mydef FOR 'LATIN1' TO 'UNICODE' FROM iso8859_1_to_utf8; CREATE DEFAULT CONVERSION public.mydef FOR 'LATIN1' TO 'UTF8' FROM iso8859_1_to_utf8;
-- --
-- cannot make default conversion with same shcema/for_encoding/to_encoding -- cannot make default conversion with same shcema/for_encoding/to_encoding
-- --
CREATE DEFAULT CONVERSION public.mydef2 FOR 'LATIN1' TO 'UNICODE' FROM iso8859_1_to_utf8; CREATE DEFAULT CONVERSION public.mydef2 FOR 'LATIN1' TO 'UTF8' FROM iso8859_1_to_utf8;
-- --
-- drop user defined conversion -- drop user defined conversion
-- --
......
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* *
* ASCII <--> UTF-8 * ASCII <--> UTF8
* *
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_ascii/utf8_and_ascii.c,v 1.9 2004/12/31 22:02:11 pgsql Exp $ * $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_ascii/utf8_and_ascii.c,v 1.10 2005/03/07 04:30:52 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
......
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* *
* BIG5 <--> UTF-8 * BIG5 <--> UTF8
* *
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_big5/utf8_and_big5.c,v 1.9 2004/12/31 22:02:13 pgsql Exp $ * $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_big5/utf8_and_big5.c,v 1.10 2005/03/07 04:30:53 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_cyrillic/utf8_and_cyrillic.c,v 1.9 2004/12/31 22:02:14 pgsql Exp $ * $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_cyrillic/utf8_and_cyrillic.c,v 1.10 2005/03/07 04:30:53 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -18,22 +18,22 @@ ...@@ -18,22 +18,22 @@
#include "../../Unicode/koi8r_to_utf8.map" #include "../../Unicode/koi8r_to_utf8.map"
#include "../../Unicode/utf8_to_win1251.map" #include "../../Unicode/utf8_to_win1251.map"
#include "../../Unicode/win1251_to_utf8.map" #include "../../Unicode/win1251_to_utf8.map"
#include "../../Unicode/utf8_to_alt.map" #include "../../Unicode/utf8_to_win866.map"
#include "../../Unicode/alt_to_utf8.map" #include "../../Unicode/win866_to_utf8.map"
PG_FUNCTION_INFO_V1(utf8_to_koi8r); PG_FUNCTION_INFO_V1(utf8_to_koi8r);
PG_FUNCTION_INFO_V1(koi8r_to_utf8); PG_FUNCTION_INFO_V1(koi8r_to_utf8);
PG_FUNCTION_INFO_V1(utf8_to_win1251); PG_FUNCTION_INFO_V1(utf8_to_win1251);
PG_FUNCTION_INFO_V1(win1251_to_utf8); PG_FUNCTION_INFO_V1(win1251_to_utf8);
PG_FUNCTION_INFO_V1(utf8_to_alt); PG_FUNCTION_INFO_V1(utf8_to_win866);
PG_FUNCTION_INFO_V1(alt_to_utf8); PG_FUNCTION_INFO_V1(win866_to_utf8);
extern Datum utf8_to_koi8r(PG_FUNCTION_ARGS); extern Datum utf8_to_koi8r(PG_FUNCTION_ARGS);
extern Datum koi8r_to_utf8(PG_FUNCTION_ARGS); extern Datum koi8r_to_utf8(PG_FUNCTION_ARGS);
extern Datum utf8_to_win1251(PG_FUNCTION_ARGS); extern Datum utf8_to_win1251(PG_FUNCTION_ARGS);
extern Datum win1251_to_utf8(PG_FUNCTION_ARGS); extern Datum win1251_to_utf8(PG_FUNCTION_ARGS);
extern Datum utf8_to_alt(PG_FUNCTION_ARGS); extern Datum utf8_to_win866(PG_FUNCTION_ARGS);
extern Datum alt_to_utf8(PG_FUNCTION_ARGS); extern Datum win866_to_utf8(PG_FUNCTION_ARGS);
/* ---------- /* ----------
* conv_proc( * conv_proc(
...@@ -115,35 +115,35 @@ win1251_to_utf8(PG_FUNCTION_ARGS) ...@@ -115,35 +115,35 @@ win1251_to_utf8(PG_FUNCTION_ARGS)
} }
Datum Datum
utf8_to_alt(PG_FUNCTION_ARGS) utf8_to_win866(PG_FUNCTION_ARGS)
{ {
unsigned char *src = PG_GETARG_CSTRING(2); unsigned char *src = PG_GETARG_CSTRING(2);
unsigned char *dest = PG_GETARG_CSTRING(3); unsigned char *dest = PG_GETARG_CSTRING(3);
int len = PG_GETARG_INT32(4); int len = PG_GETARG_INT32(4);
Assert(PG_GETARG_INT32(0) == PG_UTF8); Assert(PG_GETARG_INT32(0) == PG_UTF8);
Assert(PG_GETARG_INT32(1) == PG_ALT); Assert(PG_GETARG_INT32(1) == PG_WIN866);
Assert(len >= 0); Assert(len >= 0);
UtfToLocal(src, dest, ULmap_ALT, UtfToLocal(src, dest, ULmap_WIN866,
sizeof(ULmap_ALT) / sizeof(pg_utf_to_local), len); sizeof(ULmap_WIN866) / sizeof(pg_utf_to_local), len);
PG_RETURN_VOID(); PG_RETURN_VOID();
} }
Datum Datum
alt_to_utf8(PG_FUNCTION_ARGS) win866_to_utf8(PG_FUNCTION_ARGS)
{ {
unsigned char *src = PG_GETARG_CSTRING(2); unsigned char *src = PG_GETARG_CSTRING(2);
unsigned char *dest = PG_GETARG_CSTRING(3); unsigned char *dest = PG_GETARG_CSTRING(3);
int len = PG_GETARG_INT32(4); int len = PG_GETARG_INT32(4);
Assert(PG_GETARG_INT32(0) == PG_ALT); Assert(PG_GETARG_INT32(0) == PG_WIN866);
Assert(PG_GETARG_INT32(1) == PG_UTF8); Assert(PG_GETARG_INT32(1) == PG_UTF8);
Assert(len >= 0); Assert(len >= 0);
LocalToUtf(src, dest, LUmapALT, LocalToUtf(src, dest, LUmapWIN866,
sizeof(LUmapALT) / sizeof(pg_local_to_utf), PG_ALT, len); sizeof(LUmapWIN866) / sizeof(pg_local_to_utf), PG_WIN866, len);
PG_RETURN_VOID(); PG_RETURN_VOID();
} }
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* *
* EUC_CN <--> UTF-8 * EUC_CN <--> UTF8
* *
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_cn/utf8_and_euc_cn.c,v 1.9 2004/12/31 22:02:16 pgsql Exp $ * $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_cn/utf8_and_euc_cn.c,v 1.10 2005/03/07 04:30:53 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
......
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* *
* EUC_JP <--> UTF-8 * EUC_JP <--> UTF8
* *
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_jp/utf8_and_euc_jp.c,v 1.9 2004/12/31 22:02:17 pgsql Exp $ * $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_jp/utf8_and_euc_jp.c,v 1.10 2005/03/07 04:30:53 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
......
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* *
* EUC_KR <--> UTF-8 * EUC_KR <--> UTF8
* *
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_kr/utf8_and_euc_kr.c,v 1.9 2004/12/31 22:02:19 pgsql Exp $ * $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_kr/utf8_and_euc_kr.c,v 1.10 2005/03/07 04:30:53 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
......
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* *
* EUC_TW <--> UTF-8 * EUC_TW <--> UTF8
* *
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_tw/utf8_and_euc_tw.c,v 1.9 2004/12/31 22:02:20 pgsql Exp $ * $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_euc_tw/utf8_and_euc_tw.c,v 1.10 2005/03/07 04:30:53 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
......
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* *
* GB18030 <--> UTF-8 * GB18030 <--> UTF8
* *
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_gb18030/utf8_and_gb18030.c,v 1.9 2004/12/31 22:02:23 pgsql Exp $ * $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_gb18030/utf8_and_gb18030.c,v 1.10 2005/03/07 04:30:53 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
......
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* *
* GBK <--> UTF-8 * GBK <--> UTF8
* *
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_gbk/utf8_and_gbk.c,v 1.9 2004/12/31 22:02:26 pgsql Exp $ * $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_gbk/utf8_and_gbk.c,v 1.10 2005/03/07 04:30:53 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
......
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* *
* ISO 8859 2-16 <--> UTF-8 * ISO 8859 2-16 <--> UTF8
* *
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c,v 1.11 2004/12/31 22:02:27 pgsql Exp $ * $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_iso8859/utf8_and_iso8859.c,v 1.12 2005/03/07 04:30:54 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -61,8 +61,8 @@ extern Datum utf8_to_iso8859(PG_FUNCTION_ARGS); ...@@ -61,8 +61,8 @@ extern Datum utf8_to_iso8859(PG_FUNCTION_ARGS);
typedef struct typedef struct
{ {
pg_enc encoding; pg_enc encoding;
pg_local_to_utf *map1; /* to UTF-8 map name */ pg_local_to_utf *map1; /* to UTF8 map name */
pg_utf_to_local *map2; /* from UTF-8 map name */ pg_utf_to_local *map2; /* from UTF8 map name */
int size1; /* size of map1 */ int size1; /* size of map1 */
int size2; /* size of map2 */ int size2; /* size of map2 */
} pg_conv_map; } pg_conv_map;
...@@ -74,7 +74,7 @@ static pg_conv_map maps[] = { ...@@ -74,7 +74,7 @@ static pg_conv_map maps[] = {
{PG_EUC_KR}, /* EUC for Korean */ {PG_EUC_KR}, /* EUC for Korean */
{PG_EUC_TW}, /* EUC for Taiwan */ {PG_EUC_TW}, /* EUC for Taiwan */
{PG_JOHAB}, /* EUC for Korean JOHAB */ {PG_JOHAB}, /* EUC for Korean JOHAB */
{PG_UTF8}, /* Unicode UTF-8 */ {PG_UTF8}, /* Unicode UTF8 */
{PG_MULE_INTERNAL}, /* Mule internal code */ {PG_MULE_INTERNAL}, /* Mule internal code */
{PG_LATIN1}, /* ISO-8859-1 Latin 1 */ {PG_LATIN1}, /* ISO-8859-1 Latin 1 */
{PG_LATIN2, LUmapISO8859_2, ULmapISO8859_2, {PG_LATIN2, LUmapISO8859_2, ULmapISO8859_2,
...@@ -105,11 +105,11 @@ static pg_conv_map maps[] = { ...@@ -105,11 +105,11 @@ static pg_conv_map maps[] = {
sizeof(LUmapISO8859_16) / sizeof(pg_local_to_utf), sizeof(LUmapISO8859_16) / sizeof(pg_local_to_utf),
sizeof(ULmapISO8859_16) / sizeof(pg_utf_to_local)}, /* ISO-8859-16 Latin 10 */ sizeof(ULmapISO8859_16) / sizeof(pg_utf_to_local)}, /* ISO-8859-16 Latin 10 */
{PG_WIN1256}, /* windows-1256 */ {PG_WIN1256}, /* windows-1256 */
{PG_TCVN}, /* TCVN (Windows-1258) */ {PG_WIN1258}, /* Windows-1258 */
{PG_WIN874}, /* windows-874 */ {PG_WIN874}, /* windows-874 */
{PG_KOI8R}, /* KOI8-R */ {PG_KOI8R}, /* KOI8-R */
{PG_WIN1251}, /* windows-1251 (was: WIN) */ {PG_WIN1251}, /* windows-1251 (was: WIN) */
{PG_ALT}, /* (MS-DOS CP866) */ {PG_WIN866}, /* (MS-DOS CP866) */
{PG_ISO_8859_5, LUmapISO8859_5, ULmapISO8859_5, {PG_ISO_8859_5, LUmapISO8859_5, ULmapISO8859_5,
sizeof(LUmapISO8859_5) / sizeof(pg_local_to_utf), sizeof(LUmapISO8859_5) / sizeof(pg_local_to_utf),
sizeof(ULmapISO8859_5) / sizeof(pg_utf_to_local)}, /* ISO-8859-5 */ sizeof(ULmapISO8859_5) / sizeof(pg_utf_to_local)}, /* ISO-8859-5 */
......
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* *
* ISO8859_1 <--> UTF-8 * ISO8859_1 <--> UTF8
* *
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_iso8859_1/utf8_and_iso8859_1.c,v 1.10 2004/12/31 22:02:29 pgsql Exp $ * $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_iso8859_1/utf8_and_iso8859_1.c,v 1.11 2005/03/07 04:30:54 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -84,7 +84,7 @@ utf8_to_iso8859_1(PG_FUNCTION_ARGS) ...@@ -84,7 +84,7 @@ utf8_to_iso8859_1(PG_FUNCTION_ARGS)
len -= 2; len -= 2;
} }
else if ((c & 0xe0) == 0xe0) else if ((c & 0xe0) == 0xe0)
elog(ERROR, "could not convert UTF-8 character 0x%04x to ISO8859-1", elog(ERROR, "could not convert UTF8 character 0x%04x to ISO8859-1",
c); c);
else else
{ {
......
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* *
* JOHAB <--> UTF-8 * JOHAB <--> UTF8
* *
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_johab/utf8_and_johab.c,v 1.9 2004/12/31 22:02:31 pgsql Exp $ * $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_johab/utf8_and_johab.c,v 1.10 2005/03/07 04:30:54 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
......
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* *
* SJIS <--> UTF-8 * SJIS <--> UTF8
* *
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_sjis/utf8_and_sjis.c,v 1.9 2004/12/31 22:02:33 pgsql Exp $ * $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_sjis/utf8_and_sjis.c,v 1.10 2005/03/07 04:30:54 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
......
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* *
* UHC <--> UTF-8 * UHC <--> UTF8
* *
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_uhc/utf8_and_uhc.c,v 1.9 2004/12/31 22:02:36 pgsql Exp $ * $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_uhc/utf8_and_uhc.c,v 1.10 2005/03/07 04:30:54 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
......
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* *
* WIN1250 and UTF-8 * WIN1250 and UTF8
* *
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win1250/utf8_and_win1250.c,v 1.9 2004/12/31 22:02:38 pgsql Exp $ * $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win1250/utf8_and_win1250.c,v 1.10 2005/03/07 04:30:54 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
......
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* *
* WIN1256 and UTF-8 * WIN1256 and UTF8
* *
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win1256/utf8_and_win1256.c,v 1.9 2004/12/31 22:02:39 pgsql Exp $ * $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win1256/utf8_and_win1256.c,v 1.10 2005/03/07 04:30:54 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
......
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_tcvn/Makefile,v 1.3 2003/11/29 22:40:38 pgsql Exp $ # $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win1258/Makefile,v 1.1 2005/03/07 04:30:55 momjian Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
subdir = src/backend/utils/mb/conversion_procs/utf8_and_tcvn subdir = src/backend/utils/mb/conversion_procs/utf8_and_tcvn
top_builddir = ../../../../../.. top_builddir = ../../../../../..
include $(top_builddir)/src/Makefile.global include $(top_builddir)/src/Makefile.global
NAME := utf8_and_tcvn NAME := utf8_and_win1258
include $(srcdir)/../proc.mk include $(srcdir)/../proc.mk
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* *
* TCVN <--> UTF-8 * WIN1258 <--> UTF8
* *
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_tcvn/utf8_and_tcvn.c,v 1.9 2004/12/31 22:02:35 pgsql Exp $ * $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win1258/utf8_and_win1258.c,v 1.1 2005/03/07 04:30:55 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -14,14 +14,14 @@ ...@@ -14,14 +14,14 @@
#include "postgres.h" #include "postgres.h"
#include "fmgr.h" #include "fmgr.h"
#include "mb/pg_wchar.h" #include "mb/pg_wchar.h"
#include "../../Unicode/tcvn_to_utf8.map" #include "../../Unicode/win1258_to_utf8.map"
#include "../../Unicode/utf8_to_tcvn.map" #include "../../Unicode/utf8_to_win1258.map"
PG_FUNCTION_INFO_V1(tcvn_to_utf8); PG_FUNCTION_INFO_V1(win1258_to_utf8);
PG_FUNCTION_INFO_V1(utf8_to_tcvn); PG_FUNCTION_INFO_V1(utf8_to_win1258);
extern Datum tcvn_to_utf8(PG_FUNCTION_ARGS); extern Datum win1258_to_utf8(PG_FUNCTION_ARGS);
extern Datum utf8_to_tcvn(PG_FUNCTION_ARGS); extern Datum utf8_to_win1258(PG_FUNCTION_ARGS);
/* ---------- /* ----------
* conv_proc( * conv_proc(
...@@ -34,35 +34,35 @@ extern Datum utf8_to_tcvn(PG_FUNCTION_ARGS); ...@@ -34,35 +34,35 @@ extern Datum utf8_to_tcvn(PG_FUNCTION_ARGS);
* ---------- * ----------
*/ */
Datum Datum
tcvn_to_utf8(PG_FUNCTION_ARGS) win1258_to_utf8(PG_FUNCTION_ARGS)
{ {
unsigned char *src = PG_GETARG_CSTRING(2); unsigned char *src = PG_GETARG_CSTRING(2);
unsigned char *dest = PG_GETARG_CSTRING(3); unsigned char *dest = PG_GETARG_CSTRING(3);
int len = PG_GETARG_INT32(4); int len = PG_GETARG_INT32(4);
Assert(PG_GETARG_INT32(0) == PG_TCVN); Assert(PG_GETARG_INT32(0) == PG_WIN1258);
Assert(PG_GETARG_INT32(1) == PG_UTF8); Assert(PG_GETARG_INT32(1) == PG_UTF8);
Assert(len >= 0); Assert(len >= 0);
LocalToUtf(src, dest, LUmapTCVN, LocalToUtf(src, dest, LUmapWIN1258,
sizeof(LUmapTCVN) / sizeof(pg_local_to_utf), PG_TCVN, len); sizeof(LUmapWIN1258) / sizeof(pg_local_to_utf), PG_WIN1258, len);
PG_RETURN_VOID(); PG_RETURN_VOID();
} }
Datum Datum
utf8_to_tcvn(PG_FUNCTION_ARGS) utf8_to_win1258(PG_FUNCTION_ARGS)
{ {
unsigned char *src = PG_GETARG_CSTRING(2); unsigned char *src = PG_GETARG_CSTRING(2);
unsigned char *dest = PG_GETARG_CSTRING(3); unsigned char *dest = PG_GETARG_CSTRING(3);
int len = PG_GETARG_INT32(4); int len = PG_GETARG_INT32(4);
Assert(PG_GETARG_INT32(0) == PG_UTF8); Assert(PG_GETARG_INT32(0) == PG_UTF8);
Assert(PG_GETARG_INT32(1) == PG_TCVN); Assert(PG_GETARG_INT32(1) == PG_WIN1258);
Assert(len >= 0); Assert(len >= 0);
UtfToLocal(src, dest, ULmapTCVN, UtfToLocal(src, dest, ULmapWIN1258,
sizeof(ULmapTCVN) / sizeof(pg_utf_to_local), len); sizeof(ULmapWIN1258) / sizeof(pg_utf_to_local), len);
PG_RETURN_VOID(); PG_RETURN_VOID();
} }
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* *
* WIN874 and UTF-8 * WIN874 and UTF8
* *
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win874/utf8_and_win874.c,v 1.9 2004/12/31 22:02:41 pgsql Exp $ * $PostgreSQL: pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win874/utf8_and_win874.c,v 1.10 2005/03/07 04:30:55 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* Encoding names and routines for work with it. All * Encoding names and routines for work with it. All
* in this file is shared bedween FE and BE. * in this file is shared bedween FE and BE.
* *
* $PostgreSQL: pgsql/src/backend/utils/mb/encnames.c,v 1.22 2004/12/04 18:19:31 momjian Exp $ * $PostgreSQL: pgsql/src/backend/utils/mb/encnames.c,v 1.23 2005/03/07 04:30:52 momjian Exp $
*/ */
#ifdef FRONTEND #ifdef FRONTEND
#include "postgres_fe.h" #include "postgres_fe.h"
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
* isalnum() chars only. It means ISO-8859-1, iso_8859-1 and Iso8859_1 * isalnum() chars only. It means ISO-8859-1, iso_8859-1 and Iso8859_1
* are always converted to 'iso88591'. All must be lower case. * are always converted to 'iso88591'. All must be lower case.
* *
* The table doesn't contain 'cs' aliases (like csISOLatin1). It's needful? * The table doesn't contain 'cs' aliases (like csISOLatin1). It's needed?
* *
* Karel Zak, Aug 2001 * Karel Zak, Aug 2001
* ---------- * ----------
...@@ -35,10 +35,10 @@ ...@@ -35,10 +35,10 @@
pg_encname pg_encname_tbl[] = pg_encname pg_encname_tbl[] =
{ {
{ {
"abc", PG_TCVN "abc", PG_WIN1258
}, /* alias for TCVN */ }, /* alias for WIN1258 */
{ {
"alt", PG_ALT "alt", PG_WIN866
}, /* IBM866 */ }, /* IBM866 */
{ {
"big5", PG_BIG5 "big5", PG_BIG5
...@@ -166,23 +166,26 @@ pg_encname pg_encname_tbl[] = ...@@ -166,23 +166,26 @@ pg_encname pg_encname_tbl[] =
"sqlascii", PG_SQL_ASCII "sqlascii", PG_SQL_ASCII
}, },
{ {
"tcvn", PG_TCVN "tcvn", PG_WIN1258
}, /* TCVN; Vietnamese TCVN-5712 */ }, /* alias for WIN1258 */
{ {
"tcvn5712", PG_TCVN "tcvn5712", PG_WIN1258
}, /* alias for TCVN */ }, /* alias for WIN1258 */
{ {
"uhc", PG_UHC "uhc", PG_UHC
}, /* UHC; Korean Windows CodePage 949 */ }, /* UHC; Korean Windows CodePage 949 */
{ {
"unicode", PG_UTF8 "unicode", PG_UTF8
}, /* alias for UTF-8 */ }, /* alias for UTF8 */
{
"utf-8", PG_UTF8
}, /* UTF8; RFC2279 */
{ {
"utf8", PG_UTF8 "utf8", PG_UTF8
}, /* UTF-8; RFC2279 */ }, /* alias for UTF8 */
{ {
"vscii", PG_TCVN "vscii", PG_WIN1258
}, /* alias for TCVN */ }, /* alias for WIN1258 */
{ {
"win", PG_WIN1251 "win", PG_WIN1251
}, /* _dirty_ alias for windows-1251 }, /* _dirty_ alias for windows-1251
...@@ -197,8 +200,11 @@ pg_encname pg_encname_tbl[] = ...@@ -197,8 +200,11 @@ pg_encname pg_encname_tbl[] =
"win1256", PG_WIN1256 "win1256", PG_WIN1256
}, /* alias for Windows-1256 */ }, /* alias for Windows-1256 */
{ {
"win1258", PG_TCVN "win1258", PG_WIN1258
}, /* alias for Windows-1258 */ }, /* alias for Windows-1258 */
{
"win866", PG_WIN866
}, /* IBM866 */
{ {
"win874", PG_WIN874 "win874", PG_WIN874
}, /* alias for Windows-874 */ }, /* alias for Windows-874 */
...@@ -224,8 +230,11 @@ pg_encname pg_encname_tbl[] = ...@@ -224,8 +230,11 @@ pg_encname pg_encname_tbl[] =
"windows1256", PG_WIN1256 "windows1256", PG_WIN1256
}, /* Windows-1256; Microsoft */ }, /* Windows-1256; Microsoft */
{ {
"windows1258", PG_TCVN "windows1258", PG_WIN1258
}, /* Windows-1258; Microsoft */ }, /* Windows-1258; Microsoft */
{
"windows866", PG_WIN866
}, /* IBM866 */
{ {
"windows874", PG_WIN874 "windows874", PG_WIN874
}, /* Windows-874; Microsoft */ }, /* Windows-874; Microsoft */
...@@ -275,7 +284,7 @@ pg_enc2name pg_enc2name_tbl[] = ...@@ -275,7 +284,7 @@ pg_enc2name pg_enc2name_tbl[] =
"JOHAB", PG_JOHAB "JOHAB", PG_JOHAB
}, },
{ {
"UNICODE", PG_UTF8 "UTF8", PG_UTF8
}, },
{ {
"MULE_INTERNAL", PG_MULE_INTERNAL "MULE_INTERNAL", PG_MULE_INTERNAL
...@@ -314,19 +323,19 @@ pg_enc2name pg_enc2name_tbl[] = ...@@ -314,19 +323,19 @@ pg_enc2name pg_enc2name_tbl[] =
"WIN1256", PG_WIN1256 "WIN1256", PG_WIN1256
}, },
{ {
"TCVN", PG_TCVN "WIN1258", PG_WIN1258
}, },
{ {
"WIN874", PG_WIN874 "WIN866", PG_WIN866
}, },
{ {
"KOI8", PG_KOI8R "WIN874", PG_WIN874
}, },
{ {
"WIN", PG_WIN1251 "KOI8", PG_KOI8R
}, },
{ {
"ALT", PG_ALT "WIN1251", PG_WIN1251
}, },
{ {
"ISO_8859_5", PG_ISO_8859_5 "ISO_8859_5", PG_ISO_8859_5
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* (currently mule internal code (mic) is used) * (currently mule internal code (mic) is used)
* Tatsuo Ishii * Tatsuo Ishii
* *
* $PostgreSQL: pgsql/src/backend/utils/mb/mbutils.c,v 1.48 2004/10/13 01:25:12 neilc Exp $ * $PostgreSQL: pgsql/src/backend/utils/mb/mbutils.c,v 1.49 2005/03/07 04:30:52 momjian Exp $
*/ */
#include "postgres.h" #include "postgres.h"
...@@ -222,7 +222,7 @@ pg_get_client_encoding_name(void) ...@@ -222,7 +222,7 @@ pg_get_client_encoding_name(void)
* *
* XXX We assume that storage for converted result is 4-to-1 growth in * XXX We assume that storage for converted result is 4-to-1 growth in
* the worst case. The rate for currently supported encoding pares are within 3 * the worst case. The rate for currently supported encoding pares are within 3
* (SJIS JIS X0201 half width kanna -> UTF-8 is the worst case). * (SJIS JIS X0201 half width kanna -> UTF8 is the worst case).
* So "4" should be enough for the moment. * So "4" should be enough for the moment.
*/ */
unsigned char * unsigned char *
......
/* /*
* conversion functions between pg_wchar and multibyte streams. * conversion functions between pg_wchar and multibyte streams.
* Tatsuo Ishii * Tatsuo Ishii
* $PostgreSQL: pgsql/src/backend/utils/mb/wchar.c,v 1.40 2004/12/03 01:20:20 momjian Exp $ * $PostgreSQL: pgsql/src/backend/utils/mb/wchar.c,v 1.41 2005/03/07 04:30:52 momjian Exp $
* *
* WIN1250 client encoding updated by Pavel Behal * WIN1250 client encoding updated by Pavel Behal
* *
...@@ -344,7 +344,7 @@ pg_johab_dsplen(const unsigned char *s) ...@@ -344,7 +344,7 @@ pg_johab_dsplen(const unsigned char *s)
} }
/* /*
* convert UTF-8 string to pg_wchar (UCS-2) * convert UTF8 string to pg_wchar (UCS-2)
* caller should allocate enough space for "to" * caller should allocate enough space for "to"
* len: length of from. * len: length of from.
* "from" not necessarily null terminated. * "from" not necessarily null terminated.
...@@ -395,7 +395,7 @@ pg_utf2wchar_with_len(const unsigned char *from, pg_wchar *to, int len) ...@@ -395,7 +395,7 @@ pg_utf2wchar_with_len(const unsigned char *from, pg_wchar *to, int len)
} }
/* /*
* returns the byte length of a UTF-8 word pointed to by s * returns the byte length of a UTF8 word pointed to by s
*/ */
int int
pg_utf_mblen(const unsigned char *s) pg_utf_mblen(const unsigned char *s)
...@@ -721,7 +721,7 @@ pg_wchar_tbl pg_wchar_table[] = { ...@@ -721,7 +721,7 @@ pg_wchar_tbl pg_wchar_table[] = {
{pg_euckr2wchar_with_len, pg_euckr_mblen, pg_euckr_dsplen, 3}, /* 3; PG_EUC_KR */ {pg_euckr2wchar_with_len, pg_euckr_mblen, pg_euckr_dsplen, 3}, /* 3; PG_EUC_KR */
{pg_euctw2wchar_with_len, pg_euctw_mblen, pg_euctw_dsplen, 3}, /* 4; PG_EUC_TW */ {pg_euctw2wchar_with_len, pg_euctw_mblen, pg_euctw_dsplen, 3}, /* 4; PG_EUC_TW */
{pg_johab2wchar_with_len, pg_johab_mblen, pg_johab_dsplen, 3}, /* 5; PG_JOHAB */ {pg_johab2wchar_with_len, pg_johab_mblen, pg_johab_dsplen, 3}, /* 5; PG_JOHAB */
{pg_utf2wchar_with_len, pg_utf_mblen, pg_utf_dsplen, 3}, /* 6; PG_UNICODE */ {pg_utf2wchar_with_len, pg_utf_mblen, pg_utf_dsplen, 3}, /* 6; PG_UTF8 */
{pg_mule2wchar_with_len, pg_mule_mblen, pg_mule_dsplen, 3}, /* 7; PG_MULE_INTERNAL */ {pg_mule2wchar_with_len, pg_mule_mblen, pg_mule_dsplen, 3}, /* 7; PG_MULE_INTERNAL */
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, 1}, /* 8; PG_LATIN1 */ {pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, 1}, /* 8; PG_LATIN1 */
{pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, 1}, /* 9; PG_LATIN2 */ {pg_latin12wchar_with_len, pg_latin1_mblen, pg_latin1_dsplen, 1}, /* 9; PG_LATIN2 */
...@@ -822,7 +822,7 @@ pg_verifymbstr(const unsigned char *mbstr, int len, bool noError) ...@@ -822,7 +822,7 @@ pg_verifymbstr(const unsigned char *mbstr, int len, bool noError)
while (len > 0 && *mbstr) while (len > 0 && *mbstr)
{ {
/* special UTF-8 check */ /* special UTF8 check */
if (encoding == PG_UTF8 && (*mbstr & 0xf8) == 0xf0) if (encoding == PG_UTF8 && (*mbstr & 0xf8) == 0xf0)
{ {
if (noError) if (noError)
......
/*
* make KOI8->CP1251(win-1251) and CP1251(win-1251)->KOI8 translation table
* from koi-win.tab.
*
* Tatsuo Ishii
*
* $PostgreSQL: pgsql/src/backend/utils/mb/win.c,v 1.4 2003/11/29 22:39:59 pgsql Exp $
*/
#include <stdio.h>
main()
{
int i;
char koitab[128],
wintab[128];
char buf[4096];
int koi,
win;
for (i = 0; i < 128; i++)
koitab[i] = wintab[i] = 0;
while (fgets(buf, sizeof(buf), stdin) != NULL)
{
if (*buf == '#')
continue;
sscanf(buf, "%d %d", &koi, &win);
if (koi < 128 || koi > 255 || win < 128 || win > 255)
{
fprintf(stderr, "invalid value %d\n", koi);
exit(1);
}
koitab[koi - 128] = win;
wintab[win - 128] = koi;
}
i = 0;
printf("static char koi2win[] = {\n");
while (i < 128)
{
int j = 0;
while (j < 8)
{
printf("0x%02x", koitab[i++]);
j++;
if (i >= 128)
break;
printf(", ");
}
printf("\n");
}
printf("};\n");
i = 0;
printf("static char win2koi[] = {\n");
while (i < 128)
{
int j = 0;
while (j < 8)
{
printf("0x%02x", wintab[i++]);
j++;
if (i >= 128)
break;
printf(", ");
}
printf("\n");
}
printf("};\n");
}
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* *
* Tatsuo Ishii * Tatsuo Ishii
* *
* $PostgreSQL: pgsql/src/backend/utils/mb/alt.c,v 1.4 2003/11/29 22:39:59 pgsql Exp $ * $PostgreSQL: pgsql/src/backend/utils/mb/win866.c,v 1.1 2005/03/07 04:30:52 momjian Exp $
*/ */
#include <stdio.h> #include <stdio.h>
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* Portions taken from FreeBSD. * Portions taken from FreeBSD.
* *
* $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.76 2005/02/26 18:43:34 tgl Exp $ * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.77 2005/03/07 04:30:55 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -723,7 +723,7 @@ struct encoding_match encoding_match_list[] = { ...@@ -723,7 +723,7 @@ struct encoding_match encoding_match_list[] = {
{PG_JOHAB, "???"}, {PG_JOHAB, "???"},
#endif #endif
{PG_UTF8, "UTF-8"}, {PG_UTF8, "UTF8"},
{PG_UTF8, "utf8"}, {PG_UTF8, "utf8"},
{PG_LATIN1, "ISO-8859-1"}, {PG_LATIN1, "ISO-8859-1"},
...@@ -767,13 +767,13 @@ struct encoding_match encoding_match_list[] = { ...@@ -767,13 +767,13 @@ struct encoding_match encoding_match_list[] = {
{PG_LATIN10, "iso885916"}, {PG_LATIN10, "iso885916"},
{PG_WIN1256, "CP1256"}, {PG_WIN1256, "CP1256"},
{PG_TCVN, "CP1258"}, {PG_WIN1258, "CP1258"},
#ifdef NOT_VERIFIED #ifdef NOT_VERIFIED
{PG_WIN874, "???"}, {PG_WIN874, "???"},
#endif #endif
{PG_KOI8R, "KOI8-R"}, {PG_KOI8R, "KOI8-R"},
{PG_WIN1251, "CP1251"}, {PG_WIN1251, "CP1251"},
{PG_ALT, "CP866"}, {PG_WIN866, "CP866"},
{PG_ISO_8859_5, "ISO-8859-5"}, {PG_ISO_8859_5, "ISO-8859-5"},
{PG_ISO_8859_5, "ISO8859-5"}, {PG_ISO_8859_5, "ISO8859-5"},
......
/* $PostgreSQL: pgsql/src/include/mb/pg_wchar.h,v 1.56 2004/12/04 18:19:33 momjian Exp $ */ /* $PostgreSQL: pgsql/src/include/mb/pg_wchar.h,v 1.57 2005/03/07 04:30:55 momjian Exp $ */
#ifndef PG_WCHAR_H #ifndef PG_WCHAR_H
#define PG_WCHAR_H #define PG_WCHAR_H
...@@ -155,7 +155,7 @@ typedef enum pg_enc ...@@ -155,7 +155,7 @@ typedef enum pg_enc
PG_EUC_KR, /* EUC for Korean */ PG_EUC_KR, /* EUC for Korean */
PG_EUC_TW, /* EUC for Taiwan */ PG_EUC_TW, /* EUC for Taiwan */
PG_JOHAB, /* EUC for Korean JOHAB */ PG_JOHAB, /* EUC for Korean JOHAB */
PG_UTF8, /* Unicode UTF-8 */ PG_UTF8, /* Unicode UTF8 */
PG_MULE_INTERNAL, /* Mule internal code */ PG_MULE_INTERNAL, /* Mule internal code */
PG_LATIN1, /* ISO-8859-1 Latin 1 */ PG_LATIN1, /* ISO-8859-1 Latin 1 */
PG_LATIN2, /* ISO-8859-2 Latin 2 */ PG_LATIN2, /* ISO-8859-2 Latin 2 */
...@@ -168,11 +168,11 @@ typedef enum pg_enc ...@@ -168,11 +168,11 @@ typedef enum pg_enc
PG_LATIN9, /* ISO-8859-15 Latin9 */ PG_LATIN9, /* ISO-8859-15 Latin9 */
PG_LATIN10, /* ISO-8859-16 Latin10 */ PG_LATIN10, /* ISO-8859-16 Latin10 */
PG_WIN1256, /* windows-1256 */ PG_WIN1256, /* windows-1256 */
PG_TCVN, /* TCVN (Windows-1258) */ PG_WIN1258, /* Windows-1258 */
PG_WIN866, /* (MS-DOS CP866) */
PG_WIN874, /* windows-874 */ PG_WIN874, /* windows-874 */
PG_KOI8R, /* KOI8-R */ PG_KOI8R, /* KOI8-R */
PG_WIN1251, /* windows-1251 (was: WIN) */ PG_WIN1251, /* windows-1251 (was: WIN) */
PG_ALT, /* (MS-DOS CP866) */
PG_ISO_8859_5, /* ISO-8859-5 */ PG_ISO_8859_5, /* ISO-8859-5 */
PG_ISO_8859_6, /* ISO-8859-6 */ PG_ISO_8859_6, /* ISO-8859-6 */
PG_ISO_8859_7, /* ISO-8859-7 */ PG_ISO_8859_7, /* ISO-8859-7 */
...@@ -263,21 +263,21 @@ typedef struct ...@@ -263,21 +263,21 @@ typedef struct
extern pg_wchar_tbl pg_wchar_table[]; extern pg_wchar_tbl pg_wchar_table[];
/* /*
* UTF-8 to local code conversion map * UTF8 to local code conversion map
*/ */
typedef struct typedef struct
{ {
unsigned int utf; /* UTF-8 */ unsigned int utf; /* UTF8 */
unsigned int code; /* local code */ unsigned int code; /* local code */
} pg_utf_to_local; } pg_utf_to_local;
/* /*
* local code to UTF-8 conversion map * local code to UTF8 conversion map
*/ */
typedef struct typedef struct
{ {
unsigned int code; /* local code */ unsigned int code; /* local code */
unsigned int utf; /* UTF-8 */ unsigned int utf; /* UTF8 */
} pg_local_to_utf; } pg_local_to_utf;
extern int pg_mb2wchar(const unsigned char *from, pg_wchar *to); extern int pg_mb2wchar(const unsigned char *from, pg_wchar *to);
......
#! /bin/sh #! /bin/sh
# $PostgreSQL: pgsql/src/test/mb/mbregress.sh,v 1.7 2003/11/29 19:52:14 pgsql Exp $ # $PostgreSQL: pgsql/src/test/mb/mbregress.sh,v 1.8 2005/03/07 04:30:55 momjian Exp $
if echo '\c' | grep -s c >/dev/null 2>&1 if echo '\c' | grep -s c >/dev/null 2>&1
then then
...@@ -15,10 +15,10 @@ if [ ! -d results ];then ...@@ -15,10 +15,10 @@ if [ ! -d results ];then
fi fi
dropdb unitest dropdb unitest
createdb -E UNICODE unitest createdb -E UTF8 unitest
PSQL="psql -n -e -q" PSQL="psql -n -e -q"
tests="euc_jp sjis euc_kr euc_cn euc_tw big5 unicode mule_internal" tests="euc_jp sjis euc_kr euc_cn euc_tw big5 utf8 mule_internal"
unset PGCLIENTENCODING unset PGCLIENTENCODING
for i in $tests for i in $tests
do do
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment