Patches submitted by Kaori Inaba (i-kaori@sra.co.jp).
-<!-- $Header: /cvsroot/pgsql/doc/src/sgml/charset.sgml,v 2.26 2002/08/08 08:21:52 ishii Exp $ -->
+<!-- $Header: /cvsroot/pgsql/doc/src/sgml/charset.sgml,v 2.27 2002/08/14 02:45:09 ishii Exp $ -->
<chapter id="charset">
<title>Localization</>
</row>
<row>
<entry><literal>LATIN5</literal></entry>
- <entry><literal>LATIN5</literal>, <literal>UNICODE</literal>,
- <literal>MULE_INTERNAL</literal>
+ <entry><literal>LATIN5</literal>, <literal>UNICODE</literal>
</entry>
</row>
<row>
<entry><literal>ISO_8859_5</literal></entry>
<entry><literal>ISO_8859_5</literal>,
<literal>UNICODE</literal>,
+ <literal>MULE_INTERNAL</literal>,
<literal>WIN</literal>,
<literal>ALT</literal>,
<literal>KOI8</literal>
<literal>WIN1256</literal>,
<literal>TCVN</literal>,
<literal>WIN874</literal>,
+ <literal>GB18030</literal>,
+ <literal>WIN1250</literal>
</entry>
</row>
<row>
<entry><literal>MULE_INTERNAL</literal></entry>
<entry><literal>EUC_JP</literal>, <literal>SJIS</literal>, <literal>EUC_KR</literal>, <literal>EUC_CN</literal>,
<literal>EUC_TW</literal>, <literal>BIG5</literal>, <literal>LATIN1</literal> to <literal>LATIN5</literal>,
- <literal>WIN</literal>, <literal>ALT</literal>, <literal>WIN1250</literal></entry>
+ <literal>WIN</literal>, <literal>ALT</literal>,
+ <literal>WIN1250</literal>,
+ <literal>BIG5</literal>, <literal>ISO_8859_5</literal>, <literal>KOI8</literal></entry>
</row>
<row>
<entry><literal>KOI8</literal></entry>
<!--
-$Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.110 2002/08/09 16:45:13 tgl Exp $
+$Header: /cvsroot/pgsql/doc/src/sgml/func.sgml,v 1.111 2002/08/14 02:45:09 ishii Exp $
PostgreSQL documentation
-->
<entry>destination encoding</entry>
</row>
</thead>
+
<tbody>
<row>
- <entry>ascii_to_utf8</entry>
+ <entry>ascii_to_mic</entry>
+ <entry>SQL_ASCII</entry>
+ <entry>MULE_INTERNAL</entry>
+ </row>
+
+ <row>
+ <entry>ascii_to_utf_8</entry>
<entry>SQL_ASCII</entry>
<entry>UNICODE</entry>
</row>
</row>
<row>
- <entry>big5_to_utf8</entry>
+ <entry>big5_to_utf_8</entry>
<entry>BIG5</entry>
<entry>UNICODE</entry>
</row>
<row>
- <entry>euc_cn_to_utf8</entry>
+ <entry>euc_cn_to_mic</entry>
+ <entry>EUC_CN</entry>
+ <entry>MULE_INTERNAL</entry>
+ </row>
+
+ <row>
+ <entry>euc_cn_to_utf_8</entry>
<entry>EUC_CN</entry>
<entry>UNICODE</entry>
</row>
</row>
<row>
- <entry>euc_jp_to_utf8</entry>
+ <entry>euc_jp_to_utf_8</entry>
<entry>EUC_JP</entry>
<entry>UNICODE</entry>
</row>
<row>
- <entry>euc_kr_to_utf8</entry>
+ <entry>euc_kr_to_mic</entry>
+ <entry>EUC_KR</entry>
+ <entry>MULE_INTERNAL</entry>
+ </row>
+
+ <row>
+ <entry>euc_kr_to_utf_8</entry>
<entry>EUC_KR</entry>
<entry>UNICODE</entry>
</row>
</row>
<row>
- <entry>euc_tw_to_utf8</entry>
+ <entry>euc_tw_to_utf_8</entry>
<entry>EUC_TW</entry>
<entry>UNICODE</entry>
</row>
<row>
- <entry>gb18030_to_utf8</entry>
+ <entry>gb18030_to_utf_8</entry>
<entry>GB18030</entry>
<entry>UNICODE</entry>
</row>
<row>
- <entry>gbk_to_utf8</entry>
+ <entry>gbk_to_utf_8</entry>
<entry>GBK</entry>
<entry>UNICODE</entry>
</row>
<row>
- <entry>iso8859_10_to_utf8</entry>
+ <entry>iso_8859_10_to_utf_8</entry>
<entry>LATIN6</entry>
<entry>UNICODE</entry>
</row>
<row>
- <entry>iso8859_13_to_utf8</entry>
+ <entry>iso_8859_13_to_utf_8</entry>
<entry>LATIN7</entry>
<entry>UNICODE</entry>
</row>
<row>
- <entry>iso8859_14_to_utf8</entry>
+ <entry>iso_8859_14_to_utf_8</entry>
<entry>LATIN8</entry>
<entry>UNICODE</entry>
</row>
<row>
- <entry>iso8859_15_to_utf8</entry>
+ <entry>iso_8859_15_to_utf_8</entry>
<entry>LATIN9</entry>
<entry>UNICODE</entry>
</row>
<row>
- <entry>iso8859_16_to_utf8</entry>
+ <entry>iso_8859_16_to_utf_8</entry>
<entry>LATIN10</entry>
<entry>UNICODE</entry>
</row>
<row>
- <entry>iso8859_1_to_utf8</entry>
+ <entry>iso_8859_1_to_mic</entry>
+ <entry>LATIN1</entry>
+ <entry>MULE_INTERNAL</entry>
+ </row>
+
+ <row>
+ <entry>iso_8859_1_to_utf_8</entry>
<entry>LATIN1</entry>
<entry>UNICODE</entry>
</row>
<row>
- <entry>iso8859_2_to_utf8</entry>
+ <entry>iso_8859_2_to_mic</entry>
+ <entry>LATIN2</entry>
+ <entry>MULE_INTERNAL</entry>
+ </row>
+
+ <row>
+ <entry>iso_8859_2_to_utf_8</entry>
<entry>LATIN2</entry>
<entry>UNICODE</entry>
</row>
<row>
- <entry>iso8859_3_to_utf8</entry>
+ <entry>iso_8859_2_to_win1250</entry>
+ <entry>LATIN2</entry>
+ <entry>WIN1250</entry>
+ </row>
+
+ <row>
+ <entry>iso_8859_3_to_mic</entry>
+ <entry>LATIN3</entry>
+ <entry>MULE_INTERNAL</entry>
+ </row>
+
+ <row>
+ <entry>iso_8859_3_to_utf_8</entry>
<entry>LATIN3</entry>
<entry>UNICODE</entry>
</row>
<row>
- <entry>iso8859_4_to_utf8</entry>
+ <entry>iso_8859_4_to_mic</entry>
+ <entry>LATIN4</entry>
+ <entry>MULE_INTERNAL</entry>
+ </row>
+
+ <row>
+ <entry>iso_8859_4_to_utf_8</entry>
<entry>LATIN4</entry>
<entry>UNICODE</entry>
</row>
<row>
- <entry>iso8859_5_to_utf8</entry>
+ <entry>iso_8859_5_to_koi8r</entry>
+ <entry>ISO_8859_5</entry>
+ <entry>KOI8</entry>
+ </row>
+
+ <row>
+ <entry>iso_8859_5_to_mic</entry>
+ <entry>ISO_8859_5</entry>
+ <entry>MULE_INTERNAL</entry>
+ </row>
+
+ <row>
+ <entry>iso_8859_5_to_utf_8</entry>
<entry>ISO_8859_5</entry>
<entry>UNICODE</entry>
</row>
<row>
- <entry>iso8859_6_to_utf8</entry>
+ <entry>iso_8859_5_to_win1251</entry>
+ <entry>ISO_8859_5</entry>
+ <entry>WIN</entry>
+ </row>
+
+ <row>
+ <entry>iso_8859_5_to_win866</entry>
+ <entry>ISO_8859_5</entry>
+ <entry>ALT</entry>
+ </row>
+
+ <row>
+ <entry>iso_8859_6_to_utf_8</entry>
<entry>ISO_8859_6</entry>
<entry>UNICODE</entry>
</row>
<row>
- <entry>iso8859_7_to_utf8</entry>
+ <entry>iso_8859_7_to_utf_8</entry>
<entry>ISO_8859_7</entry>
<entry>UNICODE</entry>
</row>
<row>
- <entry>iso8859_8_to_utf8</entry>
+ <entry>iso_8859_8_to_utf_8</entry>
<entry>ISO_8859_8</entry>
<entry>UNICODE</entry>
</row>
<row>
- <entry>iso8859_9_to_utf8</entry>
+ <entry>iso_8859_9_to_utf_8</entry>
<entry>LATIN5</entry>
<entry>UNICODE</entry>
</row>
<row>
- <entry>johab_to_utf8</entry>
+ <entry>johab_to_utf_8</entry>
<entry>JOHAB</entry>
<entry>UNICODE</entry>
</row>
<row>
+ <entry>koi8r_to_iso_8859_5</entry>
+ <entry>KOI8</entry>
+ <entry>ISO_8859_5</entry>
+ </row>
+
+ <row>
+ <entry>koi8r_to_mic</entry>
+ <entry>KOI8</entry>
+ <entry>MULE_INTERNAL</entry>
+ </row>
+
+ <row>
+ <entry>koi8r_to_utf_8</entry>
+ <entry>KOI8</entry>
+ <entry>UNICODE</entry>
+ </row>
+
+ <row>
+ <entry>koi8r_to_win1251</entry>
+ <entry>KOI8</entry>
+ <entry>WIN</entry>
+ </row>
+
+ <row>
+ <entry>koi8r_to_win866</entry>
+ <entry>KOI8</entry>
+ <entry>ALT</entry>
+ </row>
+
+ <row>
+ <entry>mic_to_ascii</entry>
+ <entry>MULE_INTERNAL</entry>
+ <entry>SQL_ASCII</entry>
+ </row>
+
+ <row>
<entry>mic_to_big5</entry>
<entry>MULE_INTERNAL</entry>
<entry>BIG5</entry>
</row>
<row>
+ <entry>mic_to_euc_cn</entry>
+ <entry>MULE_INTERNAL</entry>
+ <entry>EUC_CN</entry>
+ </row>
+
+ <row>
<entry>mic_to_euc_jp</entry>
<entry>MULE_INTERNAL</entry>
<entry>EUC_JP</entry>
</row>
<row>
+ <entry>mic_to_euc_kr</entry>
+ <entry>MULE_INTERNAL</entry>
+ <entry>EUC_KR</entry>
+ </row>
+
+ <row>
<entry>mic_to_euc_tw</entry>
<entry>MULE_INTERNAL</entry>
<entry>EUC_TW</entry>
</row>
<row>
+ <entry>mic_to_iso_8859_1</entry>
+ <entry>MULE_INTERNAL</entry>
+ <entry>LATIN1</entry>
+ </row>
+
+ <row>
+ <entry>mic_to_iso_8859_2</entry>
+ <entry>MULE_INTERNAL</entry>
+ <entry>LATIN2</entry>
+ </row>
+
+ <row>
+ <entry>mic_to_iso_8859_3</entry>
+ <entry>MULE_INTERNAL</entry>
+ <entry>LATIN3</entry>
+ </row>
+
+ <row>
+ <entry>mic_to_iso_8859_4</entry>
+ <entry>MULE_INTERNAL</entry>
+ <entry>LATIN4</entry>
+ </row>
+
+ <row>
+ <entry>mic_to_iso_8859_5</entry>
+ <entry>MULE_INTERNAL</entry>
+ <entry>ISO_8859_5</entry>
+ </row>
+
+ <row>
+ <entry>mic_to_koi8r</entry>
+ <entry>MULE_INTERNAL</entry>
+ <entry>KOI8</entry>
+ </row>
+
+ <row>
<entry>mic_to_sjis</entry>
<entry>MULE_INTERNAL</entry>
<entry>SJIS</entry>
</row>
<row>
+ <entry>mic_to_win1250</entry>
+ <entry>MULE_INTERNAL</entry>
+ <entry>WIN1250</entry>
+ </row>
+
+ <row>
+ <entry>mic_to_win1251</entry>
+ <entry>MULE_INTERNAL</entry>
+ <entry>WIN</entry>
+ </row>
+
+ <row>
+ <entry>mic_to_win866</entry>
+ <entry>MULE_INTERNAL</entry>
+ <entry>ALT</entry>
+ </row>
+
+ <row>
<entry>sjis_to_euc_jp</entry>
<entry>SJIS</entry>
<entry>EUC_JP</entry>
</row>
<row>
- <entry>sjis_to_utf8</entry>
+ <entry>sjis_to_utf_8</entry>
<entry>SJIS</entry>
<entry>UNICODE</entry>
</row>
<row>
- <entry>tcvn_to_utf8</entry>
+ <entry>tcvn_to_utf_8</entry>
<entry>TCVN</entry>
<entry>UNICODE</entry>
</row>
<row>
- <entry>uhc_to_utf8</entry>
+ <entry>uhc_to_utf_8</entry>
<entry>UHC</entry>
<entry>UNICODE</entry>
</row>
<row>
- <entry>utf8_to_ascii</entry>
+ <entry>utf_8_to_ascii</entry>
<entry>UNICODE</entry>
<entry>SQL_ASCII</entry>
</row>
<row>
- <entry>utf8_to_big5</entry>
+ <entry>utf_8_to_big5</entry>
<entry>UNICODE</entry>
<entry>BIG5</entry>
</row>
<row>
- <entry>utf8_to_euc_cn</entry>
+ <entry>utf_8_to_euc_cn</entry>
<entry>UNICODE</entry>
<entry>EUC_CN</entry>
</row>
<row>
- <entry>utf8_to_euc_jp</entry>
+ <entry>utf_8_to_euc_jp</entry>
<entry>UNICODE</entry>
<entry>EUC_JP</entry>
</row>
<row>
- <entry>utf8_to_euc_kr</entry>
+ <entry>utf_8_to_euc_kr</entry>
<entry>UNICODE</entry>
<entry>EUC_KR</entry>
</row>
<row>
- <entry>utf8_to_euc_tw</entry>
+ <entry>utf_8_to_euc_tw</entry>
<entry>UNICODE</entry>
<entry>EUC_TW</entry>
</row>
<row>
- <entry>utf8_to_gb18030</entry>
+ <entry>utf_8_to_gb18030</entry>
<entry>UNICODE</entry>
<entry>GB18030</entry>
</row>
<row>
- <entry>utf8_to_gbk</entry>
+ <entry>utf_8_to_gbk</entry>
<entry>UNICODE</entry>
<entry>GBK</entry>
</row>
<row>
- <entry>utf8_to_iso8859_1</entry>
+ <entry>utf_8_to_iso_8859_1</entry>
<entry>UNICODE</entry>
<entry>LATIN1</entry>
</row>
<row>
- <entry>utf8_to_iso8859_10</entry>
+ <entry>utf_8_to_iso_8859_10</entry>
<entry>UNICODE</entry>
<entry>LATIN6</entry>
</row>
<row>
- <entry>utf8_to_iso8859_13</entry>
+ <entry>utf_8_to_iso_8859_13</entry>
<entry>UNICODE</entry>
<entry>LATIN7</entry>
</row>
<row>
- <entry>utf8_to_iso8859_14</entry>
+ <entry>utf_8_to_iso_8859_14</entry>
<entry>UNICODE</entry>
<entry>LATIN8</entry>
</row>
<row>
- <entry>utf8_to_iso8859_15</entry>
+ <entry>utf_8_to_iso_8859_15</entry>
<entry>UNICODE</entry>
<entry>LATIN9</entry>
</row>
<row>
- <entry>utf8_to_iso8859_16</entry>
+ <entry>utf_8_to_iso_8859_16</entry>
<entry>UNICODE</entry>
<entry>LATIN10</entry>
</row>
<row>
- <entry>utf8_to_iso8859_2</entry>
+ <entry>utf_8_to_iso_8859_2</entry>
<entry>UNICODE</entry>
<entry>LATIN2</entry>
</row>
<row>
- <entry>utf8_to_iso8859_3</entry>
+ <entry>utf_8_to_iso_8859_3</entry>
<entry>UNICODE</entry>
<entry>LATIN3</entry>
</row>
<row>
- <entry>utf8_to_iso8859_4</entry>
+ <entry>utf_8_to_iso_8859_4</entry>
<entry>UNICODE</entry>
<entry>LATIN4</entry>
</row>
<row>
- <entry>utf8_to_iso8859_5</entry>
+ <entry>utf_8_to_iso_8859_5</entry>
<entry>UNICODE</entry>
<entry>ISO_8859_5</entry>
</row>
<row>
- <entry>utf8_to_iso8859_6</entry>
+ <entry>utf_8_to_iso_8859_6</entry>
<entry>UNICODE</entry>
<entry>ISO_8859_6</entry>
</row>
<row>
- <entry>utf8_to_iso8859_7</entry>
+ <entry>utf_8_to_iso_8859_7</entry>
<entry>UNICODE</entry>
<entry>ISO_8859_7</entry>
</row>
<row>
- <entry>utf8_to_iso8859_8</entry>
+ <entry>utf_8_to_iso_8859_8</entry>
<entry>UNICODE</entry>
<entry>ISO_8859_8</entry>
</row>
<row>
- <entry>utf8_to_iso8859_9</entry>
+ <entry>utf_8_to_iso_8859_9</entry>
<entry>UNICODE</entry>
<entry>LATIN5</entry>
</row>
<row>
- <entry>utf8_to_johab</entry>
+ <entry>utf_8_to_johab</entry>
<entry>UNICODE</entry>
<entry>JOHAB</entry>
</row>
<row>
- <entry>utf8_to_sjis</entry>
+ <entry>utf_8_to_koi8r</entry>
+ <entry>UNICODE</entry>
+ <entry>KOI8</entry>
+ </row>
+
+ <row>
+ <entry>utf_8_to_sjis</entry>
<entry>UNICODE</entry>
<entry>SJIS</entry>
</row>
<row>
- <entry>utf8_to_tcvn</entry>
+ <entry>utf_8_to_tcvn</entry>
<entry>UNICODE</entry>
<entry>TCVN</entry>
</row>
<row>
- <entry>utf8_to_uhc</entry>
+ <entry>utf_8_to_uhc</entry>
<entry>UNICODE</entry>
<entry>UHC</entry>
</row>
+ <row>
+ <entry>utf_8_to_win1250</entry>
+ <entry>UNICODE</entry>
+ <entry>WIN1250</entry>
+ </row>
+
+ <row>
+ <entry>utf_8_to_win1251</entry>
+ <entry>UNICODE</entry>
+ <entry>WIN</entry>
+ </row>
+
+ <row>
+ <entry>utf_8_to_win1256</entry>
+ <entry>UNICODE</entry>
+ <entry>WIN1256</entry>
+ </row>
+
+ <row>
+ <entry>utf_8_to_win866</entry>
+ <entry>UNICODE</entry>
+ <entry>ALT</entry>
+ </row>
+
+ <row>
+ <entry>utf_8_to_win874</entry>
+ <entry>UNICODE</entry>
+ <entry>WIN874</entry>
+ </row>
+
+ <row>
+ <entry>win1250_to_iso_8859_2</entry>
+ <entry>WIN1250</entry>
+ <entry>LATIN2</entry>
+ </row>
+
+ <row>
+ <entry>win1250_to_mic</entry>
+ <entry>WIN1250</entry>
+ <entry>MULE_INTERNAL</entry>
+ </row>
+
+ <row>
+ <entry>win1250_to_utf_8</entry>
+ <entry>WIN1250</entry>
+ <entry>UNICODE</entry>
+ </row>
+
+ <row>
+ <entry>win1251_to_iso_8859_5</entry>
+ <entry>WIN</entry>
+ <entry>ISO_8859_5</entry>
+ </row>
+
+ <row>
+ <entry>win1251_to_koi8r</entry>
+ <entry>WIN</entry>
+ <entry>KOI8</entry>
+ </row>
+
+ <row>
+ <entry>win1251_to_mic</entry>
+ <entry>WIN</entry>
+ <entry>MULE_INTERNAL</entry>
+ </row>
+
+ <row>
+ <entry>win1251_to_utf_8</entry>
+ <entry>WIN</entry>
+ <entry>UNICODE</entry>
+ </row>
+
+ <row>
+ <entry>win1251_to_win866</entry>
+ <entry>WIN</entry>
+ <entry>ALT</entry>
+ </row>
+
+ <row>
+ <entry>win1256_to_utf_8</entry>
+ <entry>WIN1256</entry>
+ <entry>UNICODE</entry>
+ </row>
+
+ <row>
+ <entry>win866_to_iso_8859_5</entry>
+ <entry>ALT</entry>
+ <entry>ISO_8859_5</entry>
+ </row>
+
+ <row>
+ <entry>win866_to_koi8r</entry>
+ <entry>ALT</entry>
+ <entry>KOI8</entry>
+ </row>
+
+ <row>
+ <entry>win866_to_mic</entry>
+ <entry>ALT</entry>
+ <entry>MULE_INTERNAL</entry>
+ </row>
+
+ <row>
+ <entry>win866_to_utf_8</entry>
+ <entry>ALT</entry>
+ <entry>UNICODE</entry>
+ </row>
+
+ <row>
+ <entry>win866_to_win1251</entry>
+ <entry>ALT</entry>
+ <entry>WIN</entry>
+ </row>
+
+ <row>
+ <entry>win874_to_utf_8</entry>
+ <entry>WIN874</entry>
+ <entry>UNICODE</entry>
+ </row>
+
</tbody>
</tgroup>
</table>
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/mb/conv.c,v 1.41 2002/07/19 11:09:25 ishii Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/mb/conv.c,v 1.42 2002/08/14 02:45:10 ishii Exp $
*
*-------------------------------------------------------------------------
*/
}
#ifdef NOT_USED
-/*
- * EUC_KR ---> MIC
- */
-static void
-euc_kr2mic(unsigned char *euc, unsigned char *p, int len)
-{
- int c1;
-
- while (len > 0 && (c1 = *euc++))
- {
- if (c1 & 0x80)
- {
- len -= 2;
- *p++ = LC_KS5601;
- *p++ = c1;
- *p++ = *euc++;
- }
- else
- { /* should be ASCII */
- len--;
- *p++ = c1;
- }
- }
- *p = '\0';
-}
-
-/*
- * MIC ---> EUC_KR
- */
-static void
-mic2euc_kr(unsigned char *mic, unsigned char *p, int len)
-{
- int c1;
-
- while (len > 0 && (c1 = *mic))
- {
- len -= pg_mic_mblen(mic++);
-
- if (c1 == LC_KS5601)
- {
- *p++ = *mic++;
- *p++ = *mic++;
- }
- else if (c1 > 0x7f)
- { /* cannot convert to EUC_KR! */
- mic--;
- pg_print_bogus_char(&mic, &p);
- }
- else
- { /* should be ASCII */
- *p++ = c1;
- }
- }
- *p = '\0';
-}
-
-/*
- * EUC_CN ---> MIC
- */
-static void
-euc_cn2mic(unsigned char *euc, unsigned char *p, int len)
-{
- int c1;
-
- while (len > 0 && (c1 = *euc++))
- {
- if (c1 & 0x80)
- {
- len -= 2;
- *p++ = LC_GB2312_80;
- *p++ = c1;
- *p++ = *euc++;
- }
- else
- { /* should be ASCII */
- len--;
- *p++ = c1;
- }
- }
- *p = '\0';
-}
-
-/*
- * MIC ---> EUC_CN
- */
-static void
-mic2euc_cn(unsigned char *mic, unsigned char *p, int len)
-{
- int c1;
-
- while (len > 0 && (c1 = *mic))
- {
- len -= pg_mic_mblen(mic++);
-
- if (c1 == LC_GB2312_80)
- {
- *p++ = *mic++;
- *p++ = *mic++;
- }
- else if (c1 > 0x7f)
- { /* cannot convert to EUC_CN! */
- mic--;
- pg_print_bogus_char(&mic, &p);
- }
- else
- { /* should be ASCII */
- *p++ = c1;
- }
- }
- *p = '\0';
-}
/*
* GB18030 ---> MIC
*p = '\0';
}
+#endif
+
/*
* LATINn ---> MIC
*/
-static void
+void
latin2mic(unsigned char *l, unsigned char *p, int len, int lc)
{
int c1;
/*
* MIC ---> LATINn
*/
-static void
+void
mic2latin(unsigned char *mic, unsigned char *p, int len, int lc)
{
int c1;
*p = '\0';
}
-static void
-latin12mic(unsigned char *l, unsigned char *p, int len)
-{
- latin2mic(l, p, len, LC_ISO8859_1);
-}
-static void
-mic2latin1(unsigned char *mic, unsigned char *p, int len)
-{
- mic2latin(mic, p, len, LC_ISO8859_1);
-}
-static void
-latin22mic(unsigned char *l, unsigned char *p, int len)
-{
- latin2mic(l, p, len, LC_ISO8859_2);
-}
-static void
-mic2latin2(unsigned char *mic, unsigned char *p, int len)
-{
- mic2latin(mic, p, len, LC_ISO8859_2);
-}
-static void
-latin32mic(unsigned char *l, unsigned char *p, int len)
-{
- latin2mic(l, p, len, LC_ISO8859_3);
-}
-static void
-mic2latin3(unsigned char *mic, unsigned char *p, int len)
-{
- mic2latin(mic, p, len, LC_ISO8859_3);
-}
-static void
-latin42mic(unsigned char *l, unsigned char *p, int len)
-{
- latin2mic(l, p, len, LC_ISO8859_4);
-}
-static void
-mic2latin4(unsigned char *mic, unsigned char *p, int len)
-{
- mic2latin(mic, p, len, LC_ISO8859_4);
-}
-#endif
/*
* ASCII ---> MIC
*p = '\0';
}
-#ifdef NOT_USED
-/*
- * Cyrillic support
- * currently supported Cyrillic encodings:
- *
- * KOI8-R (this is the charset for the mule internal code
- * for Cyrillic)
- * ISO-8859-5
- * Microsoft's CP1251(windows-1251)
- * Alternativny Variant (MS-DOS CP866)
- */
-
-/* koi8r2mic: KOI8-R to Mule internal code */
-static void
-koi8r2mic(unsigned char *l, unsigned char *p, int len)
-{
- latin2mic(l, p, len, LC_KOI8_R);
-}
-
-/* mic2koi8r: Mule internal code to KOI8-R */
-static void
-mic2koi8r(unsigned char *mic, unsigned char *p, int len)
-{
- mic2latin(mic, p, len, LC_KOI8_R);
-}
-
/*
* latin2mic_with_table: a generic single byte charset encoding
* conversion from a local charset to the mule internal code.
* starting from 128 (0x80). each entry in the table
* holds the corresponding code point for the mule internal code.
*/
-static void
+void
latin2mic_with_table(
unsigned char *l, /* local charset string (source) */
unsigned char *p, /* pointer to store mule internal
* each entry in the table
* holds the corresponding code point for the local code.
*/
-static void
+void
mic2latin_with_table(
unsigned char *mic, /* mule internal code
* (source) */
*p = '\0';
}
-/* iso2mic: ISO-8859-5 to Mule internal code */
-static void
-iso2mic(unsigned char *l, unsigned char *p, int len)
-{
- static unsigned char iso2koi[] = {
- 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,
- 0xe1, 0xe2, 0xf7, 0xe7, 0xe4, 0xe5, 0xf6, 0xfa,
- 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0,
- 0xf2, 0xf3, 0xf4, 0xf5, 0xe6, 0xe8, 0xe3, 0xfe,
- 0xfb, 0xfd, 0xff, 0xf9, 0xf8, 0xfc, 0xe0, 0xf1,
- 0xc1, 0xc2, 0xd7, 0xc7, 0xc4, 0xc5, 0xd6, 0xda,
- 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0,
- 0xd2, 0xd3, 0xd4, 0xd5, 0xc6, 0xc8, 0xc3, 0xde,
- 0xdb, 0xdd, 0xdf, 0xd9, 0xd8, 0xdc, 0xc0, 0xd1,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
- };
-
- latin2mic_with_table(l, p, len, LC_KOI8_R, iso2koi);
-}
-
-/* mic2iso: Mule internal code to ISO8859-5 */
-static void
-mic2iso(unsigned char *mic, unsigned char *p, int len)
-{
- static unsigned char koi2iso[] = {
- 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,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0xee, 0xd0, 0xd1, 0xe6, 0xd4, 0xd5, 0xe4, 0xd3,
- 0xe5, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde,
- 0xdf, 0xef, 0xe0, 0xe1, 0xe2, 0xe3, 0xd6, 0xd2,
- 0xec, 0xeb, 0xd7, 0xe8, 0xed, 0xe9, 0xe7, 0xea,
- 0xce, 0xb0, 0xb1, 0xc6, 0xb4, 0xb5, 0xc4, 0xb3,
- 0xc5, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe,
- 0xbf, 0xcf, 0xc0, 0xc1, 0xc2, 0xc3, 0xb6, 0xb2,
- 0xcc, 0xcb, 0xb7, 0xc8, 0xcd, 0xc9, 0xc7, 0xca
- };
-
- mic2latin_with_table(mic, p, len, LC_KOI8_R, koi2iso);
-}
-
-/* win2mic: CP1251 to Mule internal code */
-static void
-win12512mic(unsigned char *l, unsigned char *p, int len)
-{
- static unsigned char win2koi[] = {
- 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, 0xbd, 0x00, 0x00,
- 0xb3, 0x00, 0xb4, 0x00, 0x00, 0x00, 0x00, 0xb7,
- 0x00, 0x00, 0xb6, 0xa6, 0xad, 0x00, 0x00, 0x00,
- 0xa3, 0x00, 0xa4, 0x00, 0x00, 0x00, 0x00, 0xa7,
- 0xe1, 0xe2, 0xf7, 0xe7, 0xe4, 0xe5, 0xf6, 0xfa,
- 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0,
- 0xf2, 0xf3, 0xf4, 0xf5, 0xe6, 0xe8, 0xe3, 0xfe,
- 0xfb, 0xfd, 0xff, 0xf9, 0xf8, 0xfc, 0xe0, 0xf1,
- 0xc1, 0xc2, 0xd7, 0xc7, 0xc4, 0xc5, 0xd6, 0xda,
- 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0,
- 0xd2, 0xd3, 0xd4, 0xd5, 0xc6, 0xc8, 0xc3, 0xde,
- 0xdb, 0xdd, 0xdf, 0xd9, 0xd8, 0xdc, 0xc0, 0xd1
- };
-
- latin2mic_with_table(l, p, len, LC_KOI8_R, win2koi);
-}
-
-/* mic2win: Mule internal code to CP1251 */
-static void
-mic2win1251(unsigned char *mic, unsigned char *p, int len)
-{
- static unsigned char koi2win[] = {
- 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, 0xb8, 0xba, 0x00, 0xb3, 0xbf,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0xa8, 0xaa, 0x00, 0xb2, 0xaf,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0xa5, 0x00, 0x00,
- 0xfe, 0xe0, 0xe1, 0xf6, 0xe4, 0xe5, 0xf4, 0xe3,
- 0xf5, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee,
- 0xef, 0xff, 0xf0, 0xf1, 0xf2, 0xf3, 0xe6, 0xe2,
- 0xfc, 0xfb, 0xe7, 0xf8, 0xfd, 0xf9, 0xf7, 0xfa,
- 0xde, 0xc0, 0xc1, 0xd6, 0xc4, 0xc5, 0xd4, 0xc3,
- 0xd5, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce,
- 0xcf, 0xdf, 0xd0, 0xd1, 0xd2, 0xd3, 0xc6, 0xc2,
- 0xdc, 0xdb, 0xc7, 0xd8, 0xdd, 0xd9, 0xd7, 0xda
- };
-
- mic2latin_with_table(mic, p, len, LC_KOI8_R, koi2win);
-}
-
-/* alt2mic: CP866 to Mule internal code */
-static void
-alt2mic(unsigned char *l, unsigned char *p, int len)
-{
- static unsigned char alt2koi[] = {
- 0xe1, 0xe2, 0xf7, 0xe7, 0xe4, 0xe5, 0xf6, 0xfa,
- 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0,
- 0xf2, 0xf3, 0xf4, 0xf5, 0xe6, 0xe8, 0xe3, 0xfe,
- 0xfb, 0xfd, 0xff, 0xf9, 0xf8, 0xfc, 0xe0, 0xf1,
- 0xc1, 0xc2, 0xd7, 0xc7, 0xc4, 0xc5, 0xd6, 0xda,
- 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0xbd, 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,
- 0xd2, 0xd3, 0xd4, 0xd5, 0xc6, 0xc8, 0xc3, 0xde,
- 0xdb, 0xdd, 0xdf, 0xd9, 0xd8, 0xdc, 0xc0, 0xd1,
- 0xb3, 0xa3, 0xb4, 0xa4, 0xb7, 0xa7, 0x00, 0x00,
- 0xb6, 0xa6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
- };
-
- latin2mic_with_table(l, p, len, LC_KOI8_R, alt2koi);
-}
-
-/* mic2alt: Mule internal code to CP866 */
-static void
-mic2alt(unsigned char *mic, unsigned char *p, int len)
-{
- static unsigned char koi2alt[] = {
- 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, 0xf1, 0xf3, 0x00, 0xf9, 0xf5,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0xad, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0xf0, 0xf2, 0x00, 0xf8, 0xf4,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0xbd, 0x00, 0x00,
- 0xee, 0xa0, 0xa1, 0xe6, 0xa4, 0xa5, 0xe4, 0xa3,
- 0xe5, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae,
- 0xaf, 0xef, 0xe0, 0xe1, 0xe2, 0xe3, 0xa6, 0xa2,
- 0xec, 0xeb, 0xa7, 0xe8, 0xed, 0xe9, 0xe7, 0xea,
- 0x9e, 0x80, 0x81, 0x96, 0x84, 0x85, 0x94, 0x83,
- 0x95, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e,
- 0x8f, 0x9f, 0x90, 0x91, 0x92, 0x93, 0x86, 0x82,
- 0x9c, 0x9b, 0x87, 0x98, 0x9d, 0x99, 0x97, 0x9a
- };
-
- mic2latin_with_table(mic, p, len, LC_KOI8_R, koi2alt);
-}
-
-/*
- * end of Cyrillic support
- */
-
-
-/*-----------------------------------------------------------------
- * WIN1250
- * Microsoft's CP1250(windows-1250)
- *-----------------------------------------------------------------*/
-static void
-win12502mic(unsigned char *l, unsigned char *p, int len)
-{
- static unsigned char win1250_2_iso88592[] = {
- 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
- 0x88, 0x89, 0xA9, 0x8B, 0xA6, 0xAB, 0xAE, 0xAC,
- 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
- 0x98, 0x99, 0xB9, 0x9B, 0xB6, 0xBB, 0xBE, 0xBC,
- 0xA0, 0xB7, 0xA2, 0xA3, 0xA4, 0xA1, 0x00, 0xA7,
- 0xA8, 0x00, 0xAA, 0x00, 0x00, 0xAD, 0x00, 0xAF,
- 0xB0, 0x00, 0xB2, 0xB3, 0xB4, 0x00, 0x00, 0x00,
- 0xB8, 0xB1, 0xBA, 0x00, 0xA5, 0xBD, 0xB5, 0xBF,
- 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7,
- 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
- 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7,
- 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF,
- 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
- 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
- 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,
- 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF
- };
-
- latin2mic_with_table(l, p, len, LC_ISO8859_2, win1250_2_iso88592);
-}
-static void
-mic2win1250(unsigned char *mic, unsigned char *p, int len)
-{
- static unsigned char iso88592_2_win1250[] = {
- 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
- 0x88, 0x89, 0x00, 0x8B, 0x00, 0x00, 0x00, 0x00,
- 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
- 0x98, 0x99, 0x00, 0x9B, 0x00, 0x00, 0x00, 0x00,
- 0xA0, 0xA5, 0xA2, 0xA3, 0xA4, 0xBC, 0x8C, 0xA7,
- 0xA8, 0x8A, 0xAA, 0x8D, 0x8F, 0xAD, 0x8E, 0xAF,
- 0xB0, 0xB9, 0xB2, 0xB3, 0xB4, 0xBE, 0x9C, 0xA1,
- 0xB8, 0x9A, 0xBA, 0x9D, 0x9F, 0xBD, 0x9E, 0xBF,
- 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7,
- 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
- 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7,
- 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF,
- 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
- 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
- 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,
- 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF
- };
-
- mic2latin_with_table(mic, p, len, LC_ISO8859_2, iso88592_2_win1250);
-}
-#endif
-
/*
* comparison routine for bsearch()
* this routine is intended for UTF-8 -> local code
sizeof(pg_utf_to_local), compare1);
if (p == NULL)
{
- elog(WARNING, "utf_to_local: could not convert UTF-8 (0x%04x). Ignored", iutf);
+ elog(WARNING, "UtfToLocal: could not convert UTF-8 (0x%04x). Ignored", iutf);
continue;
}
if (p->code & 0xff000000)
*iso = '\0';
}
-#ifdef NOT_USED
-/*
- * Cyrillic charsets
- */
-
-/*
- * UTF-8 --->KOI8-R
- */
-static void
-utf_to_KOI8R(unsigned char *utf, unsigned char *iso, int len)
-
-{
- utf_to_local(utf, iso, ULmap_KOI8R, sizeof(ULmap_KOI8R) / sizeof(pg_utf_to_local), len);
-}
-
-/*
- * UTF-8 --->WIN1251
- */
-static void
-utf_to_WIN1251(unsigned char *utf, unsigned char *iso, int len)
-
-{
- utf_to_local(utf, iso, ULmap_WIN1251, sizeof(ULmap_WIN1251) / sizeof(pg_utf_to_local), len);
-}
-
-/*
- * UTF-8 --->ALT
- */
-static void
-utf_to_ALT(unsigned char *utf, unsigned char *iso, int len)
-
-{
- utf_to_local(utf, iso, ULmap_ALT, sizeof(ULmap_ALT) / sizeof(pg_utf_to_local), len);
-}
-
-#endif
-
/*
* local code ---> UTF-8
*/
sizeof(pg_local_to_utf), compare2);
if (p == NULL)
{
- elog(WARNING, "local_to_utf: could not convert (0x%04x) %s to UTF-8. Ignored",
+ elog(WARNING, "LocalToUtf: could not convert (0x%04x) %s to UTF-8. Ignored",
iiso, (&pg_enc2name_tbl[encoding])->name);
continue;
}
}
*utf = '\0';
}
-
-#ifdef NOT_USED
-/*
- * KOI8-R ---> UTF-8
- */
-static void
-KOI8R_to_utf(unsigned char *iso, unsigned char *utf, int len)
-{
- local_to_utf(iso, utf, LUmapKOI8R, sizeof(LUmapKOI8R) / sizeof(pg_local_to_utf), PG_KOI8R, len);
-}
-
-/*
- * WIN1251 ---> UTF-8
- */
-static void
-WIN1251_to_utf(unsigned char *iso, unsigned char *utf, int len)
-{
- local_to_utf(iso, utf, LUmapWIN1251, sizeof(LUmapWIN1251) / sizeof(pg_local_to_utf), PG_WIN1251, len);
-}
-
-/*
- * ALT ---> UTF-8
- */
-static void
-ALT_to_utf(unsigned char *iso, unsigned char *utf, int len)
-{
- local_to_utf(iso, utf, LUmapALT, sizeof(LUmapALT) / sizeof(pg_local_to_utf), PG_ALT, len);
-}
-
-/*
- * UTF-8 ---> WIN1250
- */
-static void
-utf_to_win1250(unsigned char *utf, unsigned char *euc, int len)
-
-{
- utf_to_local(utf, euc, ULmapWIN1250,
- sizeof(ULmapWIN1250) / sizeof(pg_utf_to_local), len);
-}
-
-/*
- * WIN1250 ---> UTF-8
- */
-static void
-win1250_to_utf(unsigned char *euc, unsigned char *utf, int len)
-{
- local_to_utf(euc, utf, LUmapWIN1250,
- sizeof(LUmapWIN1250) / sizeof(pg_local_to_utf), PG_WIN1250, len);
-}
-
-/*
- * UTF-8 ---> WIN1256
- */
-static void
-utf_to_win1256(unsigned char *utf, unsigned char *euc, int len)
-
-{
- utf_to_local(utf, euc, ULmapWIN1256,
- sizeof(ULmapWIN1256) / sizeof(pg_utf_to_local), len);
-}
-
-/*
- * WIN1256 ---> UTF-8
- */
-static void
-win1256_to_utf(unsigned char *euc, unsigned char *utf, int len)
-{
- local_to_utf(euc, utf, LUmapWIN1256,
- sizeof(LUmapWIN1256) / sizeof(pg_local_to_utf), PG_WIN1256, len);
-}
-
-/*
- * UTF-8 ---> WIN874
- */
-static void
-utf_to_win874(unsigned char *utf, unsigned char *euc, int len)
-
-{
- utf_to_local(utf, euc, ULmapWIN874,
- sizeof(ULmapWIN874) / sizeof(pg_utf_to_local), len);
-}
-
-/*
- * WIN874 ---> UTF-8
- */
-static void
-win874_to_utf(unsigned char *euc, unsigned char *utf, int len)
-{
- local_to_utf(euc, utf, LUmapWIN874,
- sizeof(LUmapWIN874) / sizeof(pg_local_to_utf), PG_WIN874, len);
-}
-
-#endif
# Makefile for utils/mb/conversion_procs
#
# IDENTIFICATION
-# $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/Makefile,v 1.3 2002/08/06 05:40:45 ishii Exp $
+# $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/Makefile,v 1.4 2002/08/14 02:45:10 ishii Exp $
#
#-------------------------------------------------------------------------
REGRESSION_SCRIPT = conversion.sql
DIRS = \
- utf8_and_ascii utf8_and_iso8859_1 \
- utf8_and_euc_jp utf8_and_euc_kr utf8_and_euc_cn utf8_and_euc_tw \
- utf8_and_sjis utf8_and_big5 utf8_and_gbk utf8_and_gb18030 \
- utf8_and_uhc utf8_and_johab utf8_and_tcvn utf8_and_iso8859 \
- euc_jp_and_sjis euc_tw_and_big5
+ ascii_and_mic cyrillic_and_mic euc_cn_and_mic euc_jp_and_sjis \
+ euc_kr_and_mic euc_tw_and_big5 latin2_and_win1250 latin_and_mic \
+ utf8_and_ascii utf8_and_big5 utf8_and_cyrillic utf8_and_euc_cn \
+ utf8_and_euc_jp utf8_and_euc_kr utf8_and_euc_tw utf8_and_gb18030 \
+ utf8_and_gbk utf8_and_iso8859 utf8_and_iso8859_1 utf8_and_johab \
+ utf8_and_sjis utf8_and_tcvn utf8_and_uhc utf8_and_win1250 \
+ utf8_and_win1256 utf8_and_win874
+# conversion_name source_encoding destination_encoding function object
CONVERSIONS = \
- utf8_to_ascii UNICODE SQL_ASCII utf8_to_ascii utf8_and_ascii \
- ascii_to_utf8 SQL_ASCII UNICODE ascii_to_utf8 utf8_and_ascii \
- utf8_to_iso8859_1 UNICODE LATIN1 utf8_to_iso8859_1 utf8_and_iso8859_1 \
- iso8859_1_to_utf8 LATIN1 UNICODE iso8859_1_to_utf8 utf8_and_iso8859_1 \
- euc_jp_to_utf8 EUC_JP UNICODE euc_jp_to_utf8 utf8_and_euc_jp \
- utf8_to_euc_jp UNICODE EUC_JP utf8_to_euc_jp utf8_and_euc_jp \
- euc_kr_to_utf8 EUC_KR UNICODE euc_kr_to_utf8 utf8_and_euc_kr \
- utf8_to_euc_kr UNICODE EUC_KR utf8_to_euc_kr utf8_and_euc_kr \
- euc_cn_to_utf8 EUC_CN UNICODE euc_cn_to_utf8 utf8_and_euc_cn \
- utf8_to_euc_cn UNICODE EUC_CN utf8_to_euc_cn utf8_and_euc_cn \
- euc_tw_to_utf8 EUC_TW UNICODE euc_tw_to_utf8 utf8_and_euc_tw \
- utf8_to_euc_tw UNICODE EUC_TW utf8_to_euc_tw utf8_and_euc_tw \
- sjis_to_utf8 SJIS UNICODE sjis_to_utf8 utf8_and_sjis \
- utf8_to_sjis UNICODE SJIS utf8_to_sjis utf8_and_sjis \
- big5_to_utf8 BIG5 UNICODE big5_to_utf8 utf8_and_big5 \
- utf8_to_big5 UNICODE BIG5 utf8_to_big5 utf8_and_big5 \
- gbk_to_utf8 GBK UNICODE gbk_to_utf8 utf8_and_gbk \
- utf8_to_gbk UNICODE GBK utf8_to_gbk utf8_and_gbk \
- gb18030_to_utf8 GB18030 UNICODE gb18030_to_utf8 utf8_and_gb18030 \
- utf8_to_gb18030 UNICODE GB18030 utf8_to_gb18030 utf8_and_gb18030 \
- uhc_to_utf8 UHC UNICODE uhc_to_utf8 utf8_and_uhc \
- utf8_to_uhc UNICODE UHC utf8_to_uhc utf8_and_uhc \
- johab_to_utf8 JOHAB UNICODE johab_to_utf8 utf8_and_johab \
- utf8_to_johab UNICODE JOHAB utf8_to_johab utf8_and_johab \
- tcvn_to_utf8 TCVN UNICODE tcvn_to_utf8 utf8_and_tcvn \
- utf8_to_tcvn UNICODE TCVN utf8_to_tcvn utf8_and_tcvn \
- utf8_to_iso8859_2 UNICODE LATIN2 utf8_to_iso8859 utf8_and_iso8859 \
- iso8859_2_to_utf8 LATIN2 UNICODE iso8859_to_utf8 utf8_and_iso8859 \
- utf8_to_iso8859_3 UNICODE LATIN3 utf8_to_iso8859 utf8_and_iso8859 \
- iso8859_3_to_utf8 LATIN3 UNICODE iso8859_to_utf8 utf8_and_iso8859 \
- utf8_to_iso8859_4 UNICODE LATIN4 utf8_to_iso8859 utf8_and_iso8859 \
- iso8859_4_to_utf8 LATIN4 UNICODE iso8859_to_utf8 utf8_and_iso8859 \
- utf8_to_iso8859_9 UNICODE LATIN5 utf8_to_iso8859 utf8_and_iso8859 \
- iso8859_9_to_utf8 LATIN5 UNICODE iso8859_to_utf8 utf8_and_iso8859 \
- utf8_to_iso8859_10 UNICODE LATIN6 utf8_to_iso8859 utf8_and_iso8859 \
- iso8859_10_to_utf8 LATIN6 UNICODE iso8859_to_utf8 utf8_and_iso8859 \
- utf8_to_iso8859_13 UNICODE LATIN7 utf8_to_iso8859 utf8_and_iso8859 \
- iso8859_13_to_utf8 LATIN7 UNICODE iso8859_to_utf8 utf8_and_iso8859 \
- utf8_to_iso8859_14 UNICODE LATIN8 utf8_to_iso8859 utf8_and_iso8859 \
- iso8859_14_to_utf8 LATIN8 UNICODE iso8859_to_utf8 utf8_and_iso8859 \
- utf8_to_iso8859_15 UNICODE LATIN9 utf8_to_iso8859 utf8_and_iso8859 \
- iso8859_15_to_utf8 LATIN9 UNICODE iso8859_to_utf8 utf8_and_iso8859 \
- utf8_to_iso8859_16 UNICODE LATIN10 utf8_to_iso8859 utf8_and_iso8859 \
- iso8859_16_to_utf8 LATIN10 UNICODE iso8859_to_utf8 utf8_and_iso8859 \
- utf8_to_iso8859_5 UNICODE ISO-8859-5 utf8_to_iso8859 utf8_and_iso8859 \
- iso8859_5_to_utf8 ISO-8859-5 UNICODE iso8859_to_utf8 utf8_and_iso8859 \
- utf8_to_iso8859_6 UNICODE ISO-8859-6 utf8_to_iso8859 utf8_and_iso8859 \
- iso8859_6_to_utf8 ISO-8859-6 UNICODE iso8859_to_utf8 utf8_and_iso8859 \
- utf8_to_iso8859_7 UNICODE ISO-8859-7 utf8_to_iso8859 utf8_and_iso8859 \
- iso8859_7_to_utf8 ISO-8859-7 UNICODE iso8859_to_utf8 utf8_and_iso8859 \
- utf8_to_iso8859_8 UNICODE ISO-8859-8 utf8_to_iso8859 utf8_and_iso8859 \
- iso8859_8_to_utf8 ISO-8859-8 UNICODE iso8859_to_utf8 utf8_and_iso8859 \
+ ascii_to_mic SQL_ASCII MULE_INTERNAL ascii_to_mic ascii_and_mic \
+ mic_to_ascii MULE_INTERNAL SQL_ASCII mic_to_ascii ascii_and_mic \
+ koi8r_to_mic KOI8R MULE_INTERNAL koi8r_to_mic cyrillic_and_mic \
+ mic_to_koi8r MULE_INTERNAL KOI8R mic_to_koi8r cyrillic_and_mic \
+ iso_8859_5_to_mic ISO-8859-5 MULE_INTERNAL iso_to_mic cyrillic_and_mic \
+ mic_to_iso_8859_5 MULE_INTERNAL ISO-8859-5 mic_to_iso cyrillic_and_mic \
+ win1251_to_mic WIN1251 MULE_INTERNAL win1251_to_mic cyrillic_and_mic \
+ mic_to_win1251 MULE_INTERNAL WIN1251 mic_to_win1251 cyrillic_and_mic \
+ win866_to_mic ALT MULE_INTERNAL alt_to_mic cyrillic_and_mic \
+ mic_to_win866 MULE_INTERNAL ALT mic_to_alt cyrillic_and_mic \
+ koi8r_to_win1251 KOI8R WIN1251 koi8r_to_win1251 cyrillic_and_mic \
+ win1251_to_koi8r WIN1251 KOI8R win1251_to_koi8r cyrillic_and_mic \
+ koi8r_to_win866 KOI8R ALT koi8r_to_alt cyrillic_and_mic \
+ win866_to_koi8r ALT KOI8R alt_to_koi8r cyrillic_and_mic \
+ win866_to_win1251 ALT WIN1251 alt_to_win1251 cyrillic_and_mic \
+ win1251_to_win866 WIN1251 ALT win1251_to_alt cyrillic_and_mic \
+ iso_8859_5_to_koi8r ISO-8859-5 KOI8R iso_to_koi8r cyrillic_and_mic \
+ koi8r_to_iso_8859_5 KOI8R ISO-8859-5 koi8r_to_iso cyrillic_and_mic \
+ iso_8859_5_to_win1251 ISO-8859-5 WIN1251 iso_to_win1251 cyrillic_and_mic \
+ win1251_to_iso_8859_5 WIN1251 ISO-8859-5 win1251_to_iso cyrillic_and_mic \
+ iso_8859_5_to_win866 ISO-8859-5 ALT iso_to_alt cyrillic_and_mic \
+ win866_to_iso_8859_5 ALT ISO-8859-5 alt_to_iso cyrillic_and_mic \
+ euc_cn_to_mic EUC_CN MULE_INTERNAL euc_cn_to_mic euc_cn_and_mic \
+ mic_to_euc_cn MULE_INTERNAL EUC_CN mic_to_euc_cn euc_cn_and_mic \
euc_jp_to_sjis EUC_JP SJIS euc_jp_to_sjis euc_jp_and_sjis \
sjis_to_euc_jp SJIS EUC_JP sjis_to_euc_jp euc_jp_and_sjis \
euc_jp_to_mic EUC_JP MULE_INTERNAL euc_jp_to_mic euc_jp_and_sjis \
sjis_to_mic SJIS MULE_INTERNAL sjis_to_mic euc_jp_and_sjis \
mic_to_euc_jp MULE_INTERNAL EUC_JP mic_to_euc_jp euc_jp_and_sjis \
mic_to_sjis MULE_INTERNAL SJIS mic_to_sjis euc_jp_and_sjis \
+ euc_kr_to_mic EUC_KR MULE_INTERNAL euc_kr_to_mic euc_kr_and_mic \
+ mic_to_euc_kr MULE_INTERNAL EUC_KR mic_to_euc_kr euc_kr_and_mic \
euc_tw_to_big5 EUC_TW BIG5 euc_tw_to_big5 euc_tw_and_big5 \
big5_to_euc_tw BIG5 EUC_TW big5_to_euc_tw euc_tw_and_big5 \
euc_tw_to_mic EUC_TW MULE_INTERNAL euc_tw_to_mic euc_tw_and_big5 \
big5_to_mic BIG5 MULE_INTERNAL big5_to_mic euc_tw_and_big5 \
mic_to_euc_tw MULE_INTERNAL EUC_TW mic_to_euc_tw euc_tw_and_big5 \
- mic_to_big5 MULE_INTERNAL BIG5 mic_to_big5 euc_tw_and_big5
+ mic_to_big5 MULE_INTERNAL BIG5 mic_to_big5 euc_tw_and_big5 \
+ iso_8859_2_to_mic LATIN2 MULE_INTERNAL latin2_to_mic latin2_and_win1250 \
+ mic_to_iso_8859_2 MULE_INTERNAL LATIN2 mic_to_latin2 latin2_and_win1250 \
+ win1250_to_mic WIN1250 MULE_INTERNAL win1250_to_mic latin2_and_win1250 \
+ mic_to_win1250 MULE_INTERNAL WIN1250 mic_to_win1250 latin2_and_win1250 \
+ iso_8859_2_to_win1250 LATIN2 WIN1250 latin2_to_win1250 latin2_and_win1250 \
+ win1250_to_iso_8859_2 WIN1250 LATIN2 win1250_to_latin2 latin2_and_win1250 \
+ iso_8859_1_to_mic LATIN1 MULE_INTERNAL latin1_to_mic latin_and_mic \
+ mic_to_iso_8859_1 MULE_INTERNAL LATIN1 mic_to_latin1 latin_and_mic \
+ iso_8859_3_to_mic LATIN3 MULE_INTERNAL latin3_to_mic latin_and_mic \
+ mic_to_iso_8859_3 MULE_INTERNAL LATIN3 mic_to_latin3 latin_and_mic \
+ iso_8859_4_to_mic LATIN4 MULE_INTERNAL latin4_to_mic latin_and_mic \
+ mic_to_iso_8859_4 MULE_INTERNAL LATIN4 mic_to_latin4 latin_and_mic \
+ ascii_to_utf_8 SQL_ASCII UNICODE ascii_to_utf8 utf8_and_ascii \
+ utf_8_to_ascii UNICODE SQL_ASCII utf8_to_ascii utf8_and_ascii \
+ big5_to_utf_8 BIG5 UNICODE big5_to_utf8 utf8_and_big5 \
+ utf_8_to_big5 UNICODE BIG5 utf8_to_big5 utf8_and_big5 \
+ utf_8_to_koi8r UNICODE KOI8R utf8_to_koi8r utf8_and_cyrillic \
+ koi8r_to_utf_8 KOI8R UNICODE koi8r_to_utf8 utf8_and_cyrillic \
+ utf_8_to_win1251 UNICODE WIN1251 utf8_to_win1251 utf8_and_cyrillic \
+ win1251_to_utf_8 WIN1251 UNICODE win1251_to_utf8 utf8_and_cyrillic \
+ utf_8_to_win866 UNICODE ALT utf8_to_alt utf8_and_cyrillic \
+ win866_to_utf_8 ALT UNICODE alt_to_utf8 utf8_and_cyrillic \
+ euc_cn_to_utf_8 EUC_CN UNICODE euc_cn_to_utf8 utf8_and_euc_cn \
+ utf_8_to_euc_cn UNICODE EUC_CN utf8_to_euc_cn utf8_and_euc_cn \
+ euc_jp_to_utf_8 EUC_JP UNICODE euc_jp_to_utf8 utf8_and_euc_jp \
+ utf_8_to_euc_jp UNICODE EUC_JP utf8_to_euc_jp utf8_and_euc_jp \
+ euc_kr_to_utf_8 EUC_KR UNICODE euc_kr_to_utf8 utf8_and_euc_kr \
+ utf_8_to_euc_kr UNICODE EUC_KR utf8_to_euc_kr utf8_and_euc_kr \
+ euc_tw_to_utf_8 EUC_TW UNICODE euc_tw_to_utf8 utf8_and_euc_tw \
+ utf_8_to_euc_tw UNICODE EUC_TW utf8_to_euc_tw utf8_and_euc_tw \
+ gb18030_to_utf_8 GB18030 UNICODE gb18030_to_utf8 utf8_and_gb18030 \
+ utf_8_to_gb18030 UNICODE GB18030 utf8_to_gb18030 utf8_and_gb18030 \
+ gbk_to_utf_8 GBK UNICODE gbk_to_utf8 utf8_and_gbk \
+ utf_8_to_gbk UNICODE GBK utf8_to_gbk utf8_and_gbk \
+ utf_8_to_iso_8859_2 UNICODE LATIN2 utf8_to_iso8859 utf8_and_iso8859 \
+ iso_8859_2_to_utf_8 LATIN2 UNICODE iso8859_to_utf8 utf8_and_iso8859 \
+ utf_8_to_iso_8859_3 UNICODE LATIN3 utf8_to_iso8859 utf8_and_iso8859 \
+ iso_8859_3_to_utf_8 LATIN3 UNICODE iso8859_to_utf8 utf8_and_iso8859 \
+ utf_8_to_iso_8859_4 UNICODE LATIN4 utf8_to_iso8859 utf8_and_iso8859 \
+ iso_8859_4_to_utf_8 LATIN4 UNICODE iso8859_to_utf8 utf8_and_iso8859 \
+ utf_8_to_iso_8859_9 UNICODE LATIN5 utf8_to_iso8859 utf8_and_iso8859 \
+ iso_8859_9_to_utf_8 LATIN5 UNICODE iso8859_to_utf8 utf8_and_iso8859 \
+ utf_8_to_iso_8859_10 UNICODE LATIN6 utf8_to_iso8859 utf8_and_iso8859 \
+ iso_8859_10_to_utf_8 LATIN6 UNICODE iso8859_to_utf8 utf8_and_iso8859 \
+ utf_8_to_iso_8859_13 UNICODE LATIN7 utf8_to_iso8859 utf8_and_iso8859 \
+ iso_8859_13_to_utf_8 LATIN7 UNICODE iso8859_to_utf8 utf8_and_iso8859 \
+ utf_8_to_iso_8859_14 UNICODE LATIN8 utf8_to_iso8859 utf8_and_iso8859 \
+ iso_8859_14_to_utf_8 LATIN8 UNICODE iso8859_to_utf8 utf8_and_iso8859 \
+ utf_8_to_iso_8859_15 UNICODE LATIN9 utf8_to_iso8859 utf8_and_iso8859 \
+ iso_8859_15_to_utf_8 LATIN9 UNICODE iso8859_to_utf8 utf8_and_iso8859 \
+ utf_8_to_iso_8859_16 UNICODE LATIN10 utf8_to_iso8859 utf8_and_iso8859 \
+ iso_8859_16_to_utf_8 LATIN10 UNICODE iso8859_to_utf8 utf8_and_iso8859 \
+ utf_8_to_iso_8859_5 UNICODE ISO-8859-5 utf8_to_iso8859 utf8_and_iso8859 \
+ iso_8859_5_to_utf_8 ISO-8859-5 UNICODE iso8859_to_utf8 utf8_and_iso8859 \
+ utf_8_to_iso_8859_6 UNICODE ISO-8859-6 utf8_to_iso8859 utf8_and_iso8859 \
+ iso_8859_6_to_utf_8 ISO-8859-6 UNICODE iso8859_to_utf8 utf8_and_iso8859 \
+ utf_8_to_iso_8859_7 UNICODE ISO-8859-7 utf8_to_iso8859 utf8_and_iso8859 \
+ iso_8859_7_to_utf_8 ISO-8859-7 UNICODE iso8859_to_utf8 utf8_and_iso8859 \
+ utf_8_to_iso_8859_8 UNICODE ISO-8859-8 utf8_to_iso8859 utf8_and_iso8859 \
+ iso_8859_8_to_utf_8 ISO-8859-8 UNICODE iso8859_to_utf8 utf8_and_iso8859 \
+ iso_8859_1_to_utf_8 LATIN1 UNICODE iso8859_1_to_utf8 utf8_and_iso8859_1 \
+ utf_8_to_iso_8859_1 UNICODE LATIN1 utf8_to_iso8859_1 utf8_and_iso8859_1 \
+ johab_to_utf_8 JOHAB UNICODE johab_to_utf8 utf8_and_johab \
+ utf_8_to_johab UNICODE JOHAB utf8_to_johab utf8_and_johab \
+ sjis_to_utf_8 SJIS UNICODE sjis_to_utf8 utf8_and_sjis \
+ utf_8_to_sjis UNICODE SJIS utf8_to_sjis utf8_and_sjis \
+ tcvn_to_utf_8 TCVN UNICODE tcvn_to_utf8 utf8_and_tcvn \
+ utf_8_to_tcvn UNICODE TCVN utf8_to_tcvn utf8_and_tcvn \
+ uhc_to_utf_8 UHC UNICODE uhc_to_utf8 utf8_and_uhc \
+ utf_8_to_uhc UNICODE UHC utf8_to_uhc utf8_and_uhc \
+ utf_8_to_win1250 UNICODE WIN1250 utf_to_win1250 utf8_and_win1250 \
+ win1250_to_utf_8 WIN1250 UNICODE win1250_to_utf utf8_and_win1250 \
+ utf_8_to_win1256 UNICODE WIN1256 utf_to_win1256 utf8_and_win1256 \
+ win1256_to_utf_8 WIN1256 UNICODE win1256_to_utf utf8_and_win1256 \
+ utf_8_to_win874 UNICODE WIN874 utf_to_win874 utf8_and_win874 \
+ win874_to_utf_8 WIN874 UNICODE win874_to_utf utf8_and_win874
-# conversion_name source_encoding destination_encoding function object
$(SQLSCRIPT): Makefile
@set $(CONVERSIONS) ; \
while [ "$$#" -gt 0 ] ; \
distclean maintainer-clean:
$(RM) $(SQLSCRIPT)
@for dir in $(DIRS); do $(MAKE) -C $$dir $@; done
+
--- /dev/null
+#-------------------------------------------------------------------------
+#
+# $Id: Makefile,v 1.1 2002/08/14 02:45:10 ishii Exp $
+#
+#-------------------------------------------------------------------------
+top_builddir = ../../../../../..
+include $(top_builddir)/src/Makefile.global
+
+NAME := ascii_and_mic
+
+include ../proc.mk
--- /dev/null
+/*-------------------------------------------------------------------------
+ *
+ * ASCII and MULE_INTERNAL
+ *
+ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * IDENTIFICATION
+ * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/ascii_and_mic/ascii_and_mic.c,v 1.1 2002/08/14 02:45:10 ishii Exp $
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#include "postgres.h"
+#include "fmgr.h"
+#include "mb/pg_wchar.h"
+
+PG_FUNCTION_INFO_V1(ascii_to_mic)
+PG_FUNCTION_INFO_V1(mic_to_ascii)
+
+extern Datum ascii_to_mic(PG_FUNCTION_ARGS);
+extern Datum mic_to_ascii(PG_FUNCTION_ARGS);
+
+/* ----------
+ * conv_proc(
+ * INTEGER, -- source encoding id
+ * INTEGER, -- destination encoding id
+ * OPAQUE, -- source string (null terminated C string)
+ * OPAQUE, -- destination string (null terminated C string)
+ * INTEGER -- source string length
+ * ) returns INTEGER; -- dummy. returns nothing, actually.
+ * ----------
+ */
+
+Datum
+ascii_to_mic(PG_FUNCTION_ARGS)
+{
+ unsigned char *src = PG_GETARG_CSTRING(2);
+ unsigned char *dest = PG_GETARG_CSTRING(3);
+ int len = PG_GETARG_INT32(4);
+
+ Assert(PG_GETARG_INT32(0) == PG_SQL_ASCII);
+ Assert(PG_GETARG_INT32(1) == PG_MULE_INTERNAL);
+ Assert(len > 0);
+
+ pg_ascii2mic(src, dest, len);
+
+ PG_RETURN_INT32(0);
+}
+
+Datum
+mic_to_ascii(PG_FUNCTION_ARGS)
+{
+ unsigned char *src = PG_GETARG_CSTRING(2);
+ unsigned char *dest = PG_GETARG_CSTRING(3);
+ int len = PG_GETARG_INT32(4);
+
+ Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL);
+ Assert(PG_GETARG_INT32(1) == PG_SQL_ASCII);
+ Assert(len > 0);
+
+ pg_mic2ascii(src, dest, len);
+
+ PG_RETURN_INT32(0);
+}
--- /dev/null
+#-------------------------------------------------------------------------
+#
+# $Id: Makefile,v 1.1 2002/08/14 02:45:10 ishii Exp $
+#
+#-------------------------------------------------------------------------
+top_builddir = ../../../../../..
+include $(top_builddir)/src/Makefile.global
+
+NAME := cyrillic_and_mic
+
+include ../proc.mk
--- /dev/null
+/*-------------------------------------------------------------------------
+ *
+ * Cyrillic and MULE_INTERNAL
+ *
+ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * IDENTIFICATION
+ * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/cyrillic_and_mic/cyrillic_and_mic.c,v 1.1 2002/08/14 02:45:10 ishii Exp $
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#include "postgres.h"
+#include "fmgr.h"
+#include "mb/pg_wchar.h"
+
+#define ENCODING_GROWTH_RATE 4
+
+PG_FUNCTION_INFO_V1(koi8r_to_mic)
+PG_FUNCTION_INFO_V1(mic_to_koi8r)
+PG_FUNCTION_INFO_V1(iso_to_mic)
+PG_FUNCTION_INFO_V1(mic_to_iso)
+PG_FUNCTION_INFO_V1(win1251_to_mic)
+PG_FUNCTION_INFO_V1(mic_to_win1251)
+PG_FUNCTION_INFO_V1(alt_to_mic)
+PG_FUNCTION_INFO_V1(mic_to_alt)
+PG_FUNCTION_INFO_V1(koi8r_to_win1251)
+PG_FUNCTION_INFO_V1(win1251_to_koi8r)
+PG_FUNCTION_INFO_V1(koi8r_to_alt)
+PG_FUNCTION_INFO_V1(alt_to_koi8r)
+PG_FUNCTION_INFO_V1(alt_to_win1251)
+PG_FUNCTION_INFO_V1(win1251_to_alt)
+PG_FUNCTION_INFO_V1(iso_to_koi8r)
+PG_FUNCTION_INFO_V1(koi8r_to_iso)
+PG_FUNCTION_INFO_V1(iso_to_win1251)
+PG_FUNCTION_INFO_V1(win1251_to_iso)
+PG_FUNCTION_INFO_V1(iso_to_alt)
+PG_FUNCTION_INFO_V1(alt_to_iso)
+
+extern Datum koi8r_to_mic(PG_FUNCTION_ARGS);
+extern Datum mic_to_koi8r(PG_FUNCTION_ARGS);
+extern Datum iso_to_mic(PG_FUNCTION_ARGS);
+extern Datum mic_to_iso(PG_FUNCTION_ARGS);
+extern Datum win1251_to_mic(PG_FUNCTION_ARGS);
+extern Datum mic_to_win1251(PG_FUNCTION_ARGS);
+extern Datum alt_to_mic(PG_FUNCTION_ARGS);
+extern Datum mic_to_alt(PG_FUNCTION_ARGS);
+extern Datum koi8r_to_win1251(PG_FUNCTION_ARGS);
+extern Datum win1251_to_koi8r(PG_FUNCTION_ARGS);
+extern Datum koi8r_to_alt(PG_FUNCTION_ARGS);
+extern Datum alt_to_koi8r(PG_FUNCTION_ARGS);
+extern Datum alt_to_win1251(PG_FUNCTION_ARGS);
+extern Datum win1251_to_alt(PG_FUNCTION_ARGS);
+extern Datum iso_to_koi8r(PG_FUNCTION_ARGS);
+extern Datum koi8r_to_iso(PG_FUNCTION_ARGS);
+extern Datum iso_to_win1251(PG_FUNCTION_ARGS);
+extern Datum win1251_to_iso(PG_FUNCTION_ARGS);
+extern Datum iso_to_alt(PG_FUNCTION_ARGS);
+extern Datum alt_to_iso(PG_FUNCTION_ARGS);
+
+/* ----------
+ * conv_proc(
+ * INTEGER, -- source encoding id
+ * INTEGER, -- destination encoding id
+ * OPAQUE, -- source string (null terminated C string)
+ * OPAQUE, -- destination string (null terminated C string)
+ * INTEGER -- source string length
+ * ) returns INTEGER; -- dummy. returns nothing, actually.
+ * ----------
+ */
+
+static void koi8r2mic(unsigned char *l, unsigned char *p, int len);
+static void mic2koi8r(unsigned char *mic, unsigned char *p, int len);
+static void iso2mic(unsigned char *l, 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 mic2win1251(unsigned char *mic, unsigned char *p, int len);
+static void alt2mic(unsigned char *l, unsigned char *p, int len);
+static void mic2alt(unsigned char *mic, unsigned char *p, int len);
+
+Datum
+koi8r_to_mic(PG_FUNCTION_ARGS)
+{
+ unsigned char *src = PG_GETARG_CSTRING(2);
+ unsigned char *dest = PG_GETARG_CSTRING(3);
+ int len = PG_GETARG_INT32(4);
+
+ Assert(PG_GETARG_INT32(0) == PG_KOI8R);
+ Assert(PG_GETARG_INT32(1) == PG_MULE_INTERNAL);
+ Assert(len > 0);
+
+ koi8r2mic(src, dest, len);
+
+ PG_RETURN_INT32(0);
+}
+
+Datum
+mic_to_koi8r(PG_FUNCTION_ARGS)
+{
+ unsigned char *src = PG_GETARG_CSTRING(2);
+ unsigned char *dest = PG_GETARG_CSTRING(3);
+ int len = PG_GETARG_INT32(4);
+
+ Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL);
+ Assert(PG_GETARG_INT32(1) == PG_KOI8R);
+ Assert(len > 0);
+
+ mic2koi8r(src, dest, len);
+
+ PG_RETURN_INT32(0);
+}
+
+Datum
+iso_to_mic(PG_FUNCTION_ARGS)
+{
+ unsigned char *src = PG_GETARG_CSTRING(2);
+ unsigned char *dest = PG_GETARG_CSTRING(3);
+ int len = PG_GETARG_INT32(4);
+
+ Assert(PG_GETARG_INT32(0) == PG_ISO_8859_5);
+ Assert(PG_GETARG_INT32(1) == PG_MULE_INTERNAL);
+ Assert(len > 0);
+
+ iso2mic(src, dest, len);
+
+ PG_RETURN_INT32(0);
+}
+
+Datum
+mic_to_iso(PG_FUNCTION_ARGS)
+{
+ unsigned char *src = PG_GETARG_CSTRING(2);
+ unsigned char *dest = PG_GETARG_CSTRING(3);
+ int len = PG_GETARG_INT32(4);
+
+ Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL);
+ Assert(PG_GETARG_INT32(1) == PG_ISO_8859_5);
+ Assert(len > 0);
+
+ mic2iso(src, dest, len);
+
+ PG_RETURN_INT32(0);
+}
+
+Datum
+win1251_to_mic(PG_FUNCTION_ARGS)
+{
+ unsigned char *src = PG_GETARG_CSTRING(2);
+ unsigned char *dest = PG_GETARG_CSTRING(3);
+ int len = PG_GETARG_INT32(4);
+
+ Assert(PG_GETARG_INT32(0) == PG_WIN1251);
+ Assert(PG_GETARG_INT32(1) == PG_MULE_INTERNAL);
+ Assert(len > 0);
+
+ win12512mic(src, dest, len);
+
+ PG_RETURN_INT32(0);
+}
+
+Datum
+mic_to_win1251(PG_FUNCTION_ARGS)
+{
+ unsigned char *src = PG_GETARG_CSTRING(2);
+ unsigned char *dest = PG_GETARG_CSTRING(3);
+ int len = PG_GETARG_INT32(4);
+
+ Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL);
+ Assert(PG_GETARG_INT32(1) == PG_WIN1251);
+ Assert(len > 0);
+
+ mic2win1251(src, dest, len);
+
+ PG_RETURN_INT32(0);
+}
+
+Datum
+alt_to_mic(PG_FUNCTION_ARGS)
+{
+ unsigned char *src = PG_GETARG_CSTRING(2);
+ unsigned char *dest = PG_GETARG_CSTRING(3);
+ int len = PG_GETARG_INT32(4);
+
+ Assert(PG_GETARG_INT32(0) == PG_ALT);
+ Assert(PG_GETARG_INT32(1) == PG_MULE_INTERNAL);
+ Assert(len > 0);
+
+ alt2mic(src, dest, len);
+
+ PG_RETURN_INT32(0);
+}
+
+Datum
+mic_to_alt(PG_FUNCTION_ARGS)
+{
+ unsigned char *src = PG_GETARG_CSTRING(2);
+ unsigned char *dest = PG_GETARG_CSTRING(3);
+ int len = PG_GETARG_INT32(4);
+
+ Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL);
+ Assert(PG_GETARG_INT32(1) == PG_ALT);
+ Assert(len > 0);
+
+ mic2alt(src, dest, len);
+
+ PG_RETURN_INT32(0);
+}
+
+Datum
+koi8r_to_win1251(PG_FUNCTION_ARGS)
+{
+ unsigned char *src = PG_GETARG_CSTRING(2);
+ unsigned char *dest = PG_GETARG_CSTRING(3);
+ int len = PG_GETARG_INT32(4);
+ unsigned char *buf;
+
+ Assert(PG_GETARG_INT32(0) == PG_KOI8R);
+ Assert(PG_GETARG_INT32(1) == PG_WIN1251);
+ Assert(len > 0);
+
+ buf = palloc(len * ENCODING_GROWTH_RATE);
+ koi8r2mic(src, buf, len);
+ mic2win1251(buf, dest, strlen(buf));
+ pfree(buf);
+
+ PG_RETURN_INT32(0);
+}
+
+Datum
+win1251_to_koi8r(PG_FUNCTION_ARGS)
+{
+ unsigned char *src = PG_GETARG_CSTRING(2);
+ unsigned char *dest = PG_GETARG_CSTRING(3);
+ int len = PG_GETARG_INT32(4);
+ unsigned char *buf;
+
+ Assert(PG_GETARG_INT32(0) == PG_WIN1251);
+ Assert(PG_GETARG_INT32(1) == PG_KOI8R);
+ Assert(len > 0);
+
+ buf = palloc(len * ENCODING_GROWTH_RATE);
+ win12512mic(src, buf, len);
+ mic2koi8r(buf, dest, strlen(buf));
+ pfree(buf);
+
+ PG_RETURN_INT32(0);
+}
+
+Datum
+koi8r_to_alt(PG_FUNCTION_ARGS)
+{
+ unsigned char *src = PG_GETARG_CSTRING(2);
+ unsigned char *dest = PG_GETARG_CSTRING(3);
+ int len = PG_GETARG_INT32(4);
+ unsigned char *buf;
+
+ Assert(PG_GETARG_INT32(0) == PG_KOI8R);
+ Assert(PG_GETARG_INT32(1) == PG_ALT);
+ Assert(len > 0);
+
+ buf = palloc(len * ENCODING_GROWTH_RATE);
+ koi8r2mic(src, buf, len);
+ mic2alt(buf, dest, strlen(buf));
+ pfree(buf);
+
+ PG_RETURN_INT32(0);
+}
+
+Datum
+alt_to_koi8r(PG_FUNCTION_ARGS)
+{
+ unsigned char *src = PG_GETARG_CSTRING(2);
+ unsigned char *dest = PG_GETARG_CSTRING(3);
+ int len = PG_GETARG_INT32(4);
+ unsigned char *buf;
+
+ Assert(PG_GETARG_INT32(0) == PG_ALT);
+ Assert(PG_GETARG_INT32(1) == PG_KOI8R);
+ Assert(len > 0);
+
+ buf = palloc(len * ENCODING_GROWTH_RATE);
+ alt2mic(src, buf, len);
+ mic2koi8r(buf, dest, strlen(buf));
+ pfree(buf);
+
+ PG_RETURN_INT32(0);
+}
+
+Datum
+alt_to_win1251(PG_FUNCTION_ARGS)
+{
+ unsigned char *src = PG_GETARG_CSTRING(2);
+ unsigned char *dest = PG_GETARG_CSTRING(3);
+ int len = PG_GETARG_INT32(4);
+ unsigned char *buf;
+
+ Assert(PG_GETARG_INT32(0) == PG_ALT);
+ Assert(PG_GETARG_INT32(1) == PG_WIN1251);
+ Assert(len > 0);
+
+ buf = palloc(len * ENCODING_GROWTH_RATE);
+ alt2mic(src, buf, len);
+ mic2win1251(buf, dest, strlen(buf));
+ pfree(buf);
+
+ PG_RETURN_INT32(0);
+}
+
+Datum
+win1251_to_alt(PG_FUNCTION_ARGS)
+{
+ unsigned char *src = PG_GETARG_CSTRING(2);
+ unsigned char *dest = PG_GETARG_CSTRING(3);
+ int len = PG_GETARG_INT32(4);
+ unsigned char *buf;
+
+ Assert(PG_GETARG_INT32(0) == PG_WIN1251);
+ Assert(PG_GETARG_INT32(1) == PG_ALT);
+ Assert(len > 0);
+
+ buf = palloc(len * ENCODING_GROWTH_RATE);
+ win12512mic(src, buf, len);
+ mic2alt(buf, dest, strlen(buf));
+ pfree(buf);
+
+ PG_RETURN_INT32(0);
+}
+
+Datum
+iso_to_koi8r(PG_FUNCTION_ARGS)
+{
+ unsigned char *src = PG_GETARG_CSTRING(2);
+ unsigned char *dest = PG_GETARG_CSTRING(3);
+ int len = PG_GETARG_INT32(4);
+ unsigned char *buf;
+
+ Assert(PG_GETARG_INT32(0) == PG_ISO_8859_5);
+ Assert(PG_GETARG_INT32(1) == PG_KOI8R);
+ Assert(len > 0);
+
+ buf = palloc(len * ENCODING_GROWTH_RATE);
+ iso2mic(src, buf, len);
+ mic2koi8r(buf, dest, strlen(buf));
+ pfree(buf);
+
+ PG_RETURN_INT32(0);
+}
+
+Datum
+koi8r_to_iso(PG_FUNCTION_ARGS)
+{
+ unsigned char *src = PG_GETARG_CSTRING(2);
+ unsigned char *dest = PG_GETARG_CSTRING(3);
+ int len = PG_GETARG_INT32(4);
+ unsigned char *buf;
+
+ Assert(PG_GETARG_INT32(0) == PG_KOI8R);
+ Assert(PG_GETARG_INT32(1) == PG_ISO_8859_5);
+ Assert(len > 0);
+
+ buf = palloc(len * ENCODING_GROWTH_RATE);
+ koi8r2mic(src, buf, len);
+ mic2iso(buf, dest, strlen(buf));
+ pfree(buf);
+
+ PG_RETURN_INT32(0);
+}
+
+Datum
+iso_to_win1251(PG_FUNCTION_ARGS)
+{
+ unsigned char *src = PG_GETARG_CSTRING(2);
+ unsigned char *dest = PG_GETARG_CSTRING(3);
+ int len = PG_GETARG_INT32(4);
+ unsigned char *buf;
+
+ Assert(PG_GETARG_INT32(0) == PG_ISO_8859_5);
+ Assert(PG_GETARG_INT32(1) == PG_WIN1251);
+ Assert(len > 0);
+
+ buf = palloc(len * ENCODING_GROWTH_RATE);
+ iso2mic(src, buf, len);
+ mic2win1251(buf, dest, strlen(buf));
+ pfree(buf);
+
+ PG_RETURN_INT32(0);
+}
+
+Datum
+win1251_to_iso(PG_FUNCTION_ARGS)
+{
+ unsigned char *src = PG_GETARG_CSTRING(2);
+ unsigned char *dest = PG_GETARG_CSTRING(3);
+ int len = PG_GETARG_INT32(4);
+ unsigned char *buf;
+
+ Assert(PG_GETARG_INT32(0) == PG_WIN1251);
+ Assert(PG_GETARG_INT32(1) == PG_ISO_8859_5);
+ Assert(len > 0);
+
+ buf = palloc(len * ENCODING_GROWTH_RATE);
+ win12512mic(src, buf, len);
+ mic2win1251(buf, dest, strlen(buf));
+ pfree(buf);
+
+ PG_RETURN_INT32(0);
+}
+
+Datum
+iso_to_alt(PG_FUNCTION_ARGS)
+{
+ unsigned char *src = PG_GETARG_CSTRING(2);
+ unsigned char *dest = PG_GETARG_CSTRING(3);
+ int len = PG_GETARG_INT32(4);
+ unsigned char *buf;
+
+ Assert(PG_GETARG_INT32(0) == PG_ISO_8859_5);
+ Assert(PG_GETARG_INT32(1) == PG_ALT);
+ Assert(len > 0);
+
+ buf = palloc(len * ENCODING_GROWTH_RATE);
+ iso2mic(src, buf, len);
+ mic2alt(buf, dest, strlen(buf));
+ pfree(buf);
+
+ PG_RETURN_INT32(0);
+}
+
+Datum
+alt_to_iso(PG_FUNCTION_ARGS)
+{
+ unsigned char *src = PG_GETARG_CSTRING(2);
+ unsigned char *dest = PG_GETARG_CSTRING(3);
+ int len = PG_GETARG_INT32(4);
+ unsigned char *buf;
+
+ Assert(PG_GETARG_INT32(0) == PG_ALT);
+ Assert(PG_GETARG_INT32(1) == PG_ISO_8859_5);
+ Assert(len > 0);
+
+ buf = palloc(len * ENCODING_GROWTH_RATE);
+ alt2mic(src, buf, len);
+ mic2alt(buf, dest, strlen(buf));
+ pfree(buf);
+
+ PG_RETURN_INT32(0);
+}
+
+/*
+ * Cyrillic support
+ * currently supported Cyrillic encodings:
+ *
+ * KOI8-R (this is the charset for the mule internal code
+ * for Cyrillic)
+ * ISO-8859-5
+ * Microsoft's CP1251(windows-1251)
+ * Alternativny Variant (MS-DOS CP866)
+ */
+
+/* koi8r2mic: KOI8-R to Mule internal code */
+static void
+koi8r2mic(unsigned char *l, unsigned char *p, int len)
+{
+ latin2mic(l, p, len, LC_KOI8_R);
+}
+
+/* mic2koi8r: Mule internal code to KOI8-R */
+static void
+mic2koi8r(unsigned char *mic, unsigned char *p, int len)
+{
+ mic2latin(mic, p, len, LC_KOI8_R);
+}
+
+/* iso2mic: ISO-8859-5 to Mule internal code */
+static void
+iso2mic(unsigned char *l, unsigned char *p, int len)
+{
+ static unsigned char iso2koi[] = {
+ 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,
+ 0xe1, 0xe2, 0xf7, 0xe7, 0xe4, 0xe5, 0xf6, 0xfa,
+ 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0,
+ 0xf2, 0xf3, 0xf4, 0xf5, 0xe6, 0xe8, 0xe3, 0xfe,
+ 0xfb, 0xfd, 0xff, 0xf9, 0xf8, 0xfc, 0xe0, 0xf1,
+ 0xc1, 0xc2, 0xd7, 0xc7, 0xc4, 0xc5, 0xd6, 0xda,
+ 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0,
+ 0xd2, 0xd3, 0xd4, 0xd5, 0xc6, 0xc8, 0xc3, 0xde,
+ 0xdb, 0xdd, 0xdf, 0xd9, 0xd8, 0xdc, 0xc0, 0xd1,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+
+ latin2mic_with_table(l, p, len, LC_KOI8_R, iso2koi);
+}
+
+/* mic2iso: Mule internal code to ISO8859-5 */
+static void
+mic2iso(unsigned char *mic, unsigned char *p, int len)
+{
+ static unsigned char koi2iso[] = {
+ 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,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0xee, 0xd0, 0xd1, 0xe6, 0xd4, 0xd5, 0xe4, 0xd3,
+ 0xe5, 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde,
+ 0xdf, 0xef, 0xe0, 0xe1, 0xe2, 0xe3, 0xd6, 0xd2,
+ 0xec, 0xeb, 0xd7, 0xe8, 0xed, 0xe9, 0xe7, 0xea,
+ 0xce, 0xb0, 0xb1, 0xc6, 0xb4, 0xb5, 0xc4, 0xb3,
+ 0xc5, 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe,
+ 0xbf, 0xcf, 0xc0, 0xc1, 0xc2, 0xc3, 0xb6, 0xb2,
+ 0xcc, 0xcb, 0xb7, 0xc8, 0xcd, 0xc9, 0xc7, 0xca
+ };
+
+ mic2latin_with_table(mic, p, len, LC_KOI8_R, koi2iso);
+}
+
+/* win2mic: CP1251 to Mule internal code */
+static void
+win12512mic(unsigned char *l, unsigned char *p, int len)
+{
+ static unsigned char win2koi[] = {
+ 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, 0xbd, 0x00, 0x00,
+ 0xb3, 0x00, 0xb4, 0x00, 0x00, 0x00, 0x00, 0xb7,
+ 0x00, 0x00, 0xb6, 0xa6, 0xad, 0x00, 0x00, 0x00,
+ 0xa3, 0x00, 0xa4, 0x00, 0x00, 0x00, 0x00, 0xa7,
+ 0xe1, 0xe2, 0xf7, 0xe7, 0xe4, 0xe5, 0xf6, 0xfa,
+ 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0,
+ 0xf2, 0xf3, 0xf4, 0xf5, 0xe6, 0xe8, 0xe3, 0xfe,
+ 0xfb, 0xfd, 0xff, 0xf9, 0xf8, 0xfc, 0xe0, 0xf1,
+ 0xc1, 0xc2, 0xd7, 0xc7, 0xc4, 0xc5, 0xd6, 0xda,
+ 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0,
+ 0xd2, 0xd3, 0xd4, 0xd5, 0xc6, 0xc8, 0xc3, 0xde,
+ 0xdb, 0xdd, 0xdf, 0xd9, 0xd8, 0xdc, 0xc0, 0xd1
+ };
+
+ latin2mic_with_table(l, p, len, LC_KOI8_R, win2koi);
+}
+
+/* mic2win: Mule internal code to CP1251 */
+static void
+mic2win1251(unsigned char *mic, unsigned char *p, int len)
+{
+ static unsigned char koi2win[] = {
+ 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, 0xb8, 0xba, 0x00, 0xb3, 0xbf,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0xa8, 0xaa, 0x00, 0xb2, 0xaf,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xa5, 0x00, 0x00,
+ 0xfe, 0xe0, 0xe1, 0xf6, 0xe4, 0xe5, 0xf4, 0xe3,
+ 0xf5, 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee,
+ 0xef, 0xff, 0xf0, 0xf1, 0xf2, 0xf3, 0xe6, 0xe2,
+ 0xfc, 0xfb, 0xe7, 0xf8, 0xfd, 0xf9, 0xf7, 0xfa,
+ 0xde, 0xc0, 0xc1, 0xd6, 0xc4, 0xc5, 0xd4, 0xc3,
+ 0xd5, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce,
+ 0xcf, 0xdf, 0xd0, 0xd1, 0xd2, 0xd3, 0xc6, 0xc2,
+ 0xdc, 0xdb, 0xc7, 0xd8, 0xdd, 0xd9, 0xd7, 0xda
+ };
+
+ mic2latin_with_table(mic, p, len, LC_KOI8_R, koi2win);
+}
+
+/* alt2mic: CP866 to Mule internal code */
+static void
+alt2mic(unsigned char *l, unsigned char *p, int len)
+{
+ static unsigned char alt2koi[] = {
+ 0xe1, 0xe2, 0xf7, 0xe7, 0xe4, 0xe5, 0xf6, 0xfa,
+ 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0,
+ 0xf2, 0xf3, 0xf4, 0xf5, 0xe6, 0xe8, 0xe3, 0xfe,
+ 0xfb, 0xfd, 0xff, 0xf9, 0xf8, 0xfc, 0xe0, 0xf1,
+ 0xc1, 0xc2, 0xd7, 0xc7, 0xc4, 0xc5, 0xd6, 0xda,
+ 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xbd, 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,
+ 0xd2, 0xd3, 0xd4, 0xd5, 0xc6, 0xc8, 0xc3, 0xde,
+ 0xdb, 0xdd, 0xdf, 0xd9, 0xd8, 0xdc, 0xc0, 0xd1,
+ 0xb3, 0xa3, 0xb4, 0xa4, 0xb7, 0xa7, 0x00, 0x00,
+ 0xb6, 0xa6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+ };
+
+ latin2mic_with_table(l, p, len, LC_KOI8_R, alt2koi);
+}
+
+/* mic2alt: Mule internal code to CP866 */
+static void
+mic2alt(unsigned char *mic, unsigned char *p, int len)
+{
+ static unsigned char koi2alt[] = {
+ 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, 0xf1, 0xf3, 0x00, 0xf9, 0xf5,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xad, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0xf0, 0xf2, 0x00, 0xf8, 0xf4,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0xbd, 0x00, 0x00,
+ 0xee, 0xa0, 0xa1, 0xe6, 0xa4, 0xa5, 0xe4, 0xa3,
+ 0xe5, 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae,
+ 0xaf, 0xef, 0xe0, 0xe1, 0xe2, 0xe3, 0xa6, 0xa2,
+ 0xec, 0xeb, 0xa7, 0xe8, 0xed, 0xe9, 0xe7, 0xea,
+ 0x9e, 0x80, 0x81, 0x96, 0x84, 0x85, 0x94, 0x83,
+ 0x95, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e,
+ 0x8f, 0x9f, 0x90, 0x91, 0x92, 0x93, 0x86, 0x82,
+ 0x9c, 0x9b, 0x87, 0x98, 0x9d, 0x99, 0x97, 0x9a
+ };
+
+ mic2latin_with_table(mic, p, len, LC_KOI8_R, koi2alt);
+}
+
--- /dev/null
+#-------------------------------------------------------------------------
+#
+# $Id: Makefile,v 1.1 2002/08/14 02:45:10 ishii Exp $
+#
+#-------------------------------------------------------------------------
+top_builddir = ../../../../../..
+include $(top_builddir)/src/Makefile.global
+
+NAME := euc_cn_and_mic
+
+include ../proc.mk
--- /dev/null
+/*-------------------------------------------------------------------------
+ *
+ * EUC_CN and MULE_INTERNAL
+ *
+ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * IDENTIFICATION
+ * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/euc_cn_and_mic/euc_cn_and_mic.c,v 1.1 2002/08/14 02:45:10 ishii Exp $
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#include "postgres.h"
+#include "fmgr.h"
+#include "mb/pg_wchar.h"
+
+PG_FUNCTION_INFO_V1(euc_cn_to_mic)
+PG_FUNCTION_INFO_V1(mic_to_euc_cn)
+
+extern Datum euc_cn_to_mic(PG_FUNCTION_ARGS);
+extern Datum mic_to_euc_cn(PG_FUNCTION_ARGS);
+
+/* ----------
+ * conv_proc(
+ * INTEGER, -- source encoding id
+ * INTEGER, -- destination encoding id
+ * OPAQUE, -- source string (null terminated C string)
+ * OPAQUE, -- destination string (null terminated C string)
+ * INTEGER -- source string length
+ * ) returns INTEGER; -- dummy. returns nothing, actually.
+ * ----------
+ */
+
+static void euc_cn2mic(unsigned char *euc, unsigned char *p, int len);
+static void mic2euc_cn(unsigned char *mic, unsigned char *p, int len);
+
+Datum
+euc_cn_to_mic(PG_FUNCTION_ARGS)
+{
+ unsigned char *src = PG_GETARG_CSTRING(2);
+ unsigned char *dest = PG_GETARG_CSTRING(3);
+ int len = PG_GETARG_INT32(4);
+
+ Assert(PG_GETARG_INT32(0) == PG_EUC_CN);
+ Assert(PG_GETARG_INT32(1) == PG_MULE_INTERNAL);
+ Assert(len > 0);
+
+ euc_cn2mic(src, dest, len);
+
+ PG_RETURN_INT32(0);
+}
+
+Datum
+mic_to_euc_cn(PG_FUNCTION_ARGS)
+{
+ unsigned char *src = PG_GETARG_CSTRING(2);
+ unsigned char *dest = PG_GETARG_CSTRING(3);
+ int len = PG_GETARG_INT32(4);
+
+ Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL);
+ Assert(PG_GETARG_INT32(1) == PG_EUC_CN);
+ Assert(len > 0);
+
+ mic2euc_cn(src, dest, len);
+
+ PG_RETURN_INT32(0);
+}
+
+/*
+ * EUC_CN ---> MIC
+ */
+static void
+euc_cn2mic(unsigned char *euc, unsigned char *p, int len)
+{
+ int c1;
+
+ while (len > 0 && (c1 = *euc++))
+ {
+ if (c1 & 0x80)
+ {
+ len -= 2;
+ *p++ = LC_GB2312_80;
+ *p++ = c1;
+ *p++ = *euc++;
+ }
+ else
+ { /* should be ASCII */
+ len--;
+ *p++ = c1;
+ }
+ }
+ *p = '\0';
+}
+
+/*
+ * MIC ---> EUC_CN
+ */
+static void
+mic2euc_cn(unsigned char *mic, unsigned char *p, int len)
+{
+ int c1;
+
+ while (len > 0 && (c1 = *mic))
+ {
+ len -= pg_mic_mblen(mic++);
+
+ if (c1 == LC_GB2312_80)
+ {
+ *p++ = *mic++;
+ *p++ = *mic++;
+ }
+ else if (c1 > 0x7f)
+ { /* cannot convert to EUC_CN! */
+ mic--;
+ pg_print_bogus_char(&mic, &p);
+ }
+ else
+ { /* should be ASCII */
+ *p++ = c1;
+ }
+ }
+ *p = '\0';
+}
--- /dev/null
+#-------------------------------------------------------------------------
+#
+# $Id: Makefile,v 1.1 2002/08/14 02:45:10 ishii Exp $
+#
+#-------------------------------------------------------------------------
+top_builddir = ../../../../../..
+include $(top_builddir)/src/Makefile.global
+
+NAME := euc_kr_and_mic
+
+include ../proc.mk
--- /dev/null
+/*-------------------------------------------------------------------------
+ *
+ * EUC_KR and MULE_INTERNAL
+ *
+ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * IDENTIFICATION
+ * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/euc_kr_and_mic/euc_kr_and_mic.c,v 1.1 2002/08/14 02:45:10 ishii Exp $
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#include "postgres.h"
+#include "fmgr.h"
+#include "mb/pg_wchar.h"
+
+PG_FUNCTION_INFO_V1(euc_kr_to_mic)
+PG_FUNCTION_INFO_V1(mic_to_euc_kr)
+
+extern Datum euc_kr_to_mic(PG_FUNCTION_ARGS);
+extern Datum mic_to_euc_kr(PG_FUNCTION_ARGS);
+
+/* ----------
+ * conv_proc(
+ * INTEGER, -- source encoding id
+ * INTEGER, -- destination encoding id
+ * OPAQUE, -- source string (null terminated C string)
+ * OPAQUE, -- destination string (null terminated C string)
+ * INTEGER -- source string length
+ * ) returns INTEGER; -- dummy. returns nothing, actually.
+ * ----------
+ */
+
+static void euc_kr2mic(unsigned char *euc, unsigned char *p, int len);
+static void mic2euc_kr(unsigned char *mic, unsigned char *p, int len);
+
+Datum
+euc_kr_to_mic(PG_FUNCTION_ARGS)
+{
+ unsigned char *src = PG_GETARG_CSTRING(2);
+ unsigned char *dest = PG_GETARG_CSTRING(3);
+ int len = PG_GETARG_INT32(4);
+
+ Assert(PG_GETARG_INT32(0) == PG_EUC_KR);
+ Assert(PG_GETARG_INT32(1) == PG_MULE_INTERNAL);
+ Assert(len > 0);
+
+ euc_kr2mic(src, dest, len);
+
+ PG_RETURN_INT32(0);
+}
+
+Datum
+mic_to_euc_kr(PG_FUNCTION_ARGS)
+{
+ unsigned char *src = PG_GETARG_CSTRING(2);
+ unsigned char *dest = PG_GETARG_CSTRING(3);
+ int len = PG_GETARG_INT32(4);
+
+ Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL);
+ Assert(PG_GETARG_INT32(1) == PG_EUC_KR);
+ Assert(len > 0);
+
+ mic2euc_kr(src, dest, len);
+
+ PG_RETURN_INT32(0);
+}
+
+/*
+ * EUC_KR ---> MIC
+ */
+static void
+euc_kr2mic(unsigned char *euc, unsigned char *p, int len)
+{
+ int c1;
+
+ while (len > 0 && (c1 = *euc++))
+ {
+ if (c1 & 0x80)
+ {
+ len -= 2;
+ *p++ = LC_KS5601;
+ *p++ = c1;
+ *p++ = *euc++;
+ }
+ else
+ { /* should be ASCII */
+ len--;
+ *p++ = c1;
+ }
+ }
+ *p = '\0';
+}
+
+/*
+ * MIC ---> EUC_KR
+ */
+static void
+mic2euc_kr(unsigned char *mic, unsigned char *p, int len)
+{
+ int c1;
+
+ while (len > 0 && (c1 = *mic))
+ {
+ len -= pg_mic_mblen(mic++);
+
+ if (c1 == LC_KS5601)
+ {
+ *p++ = *mic++;
+ *p++ = *mic++;
+ }
+ else if (c1 > 0x7f)
+ { /* cannot convert to EUC_KR! */
+ mic--;
+ pg_print_bogus_char(&mic, &p);
+ }
+ else
+ { /* should be ASCII */
+ *p++ = c1;
+ }
+ }
+ *p = '\0';
+}
+
--- /dev/null
+#-------------------------------------------------------------------------
+#
+# $Id: Makefile,v 1.1 2002/08/14 02:45:10 ishii Exp $
+#
+#-------------------------------------------------------------------------
+top_builddir = ../../../../../..
+include $(top_builddir)/src/Makefile.global
+
+NAME := latin2_and_win1250
+
+include ../proc.mk
--- /dev/null
+/*-------------------------------------------------------------------------
+ *
+ * LATIN2 and WIN1250
+ *
+ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * IDENTIFICATION
+ * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/latin2_and_win1250/latin2_and_win1250.c,v 1.1 2002/08/14 02:45:10 ishii Exp $
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#include "postgres.h"
+#include "fmgr.h"
+#include "mb/pg_wchar.h"
+
+#define ENCODING_GROWTH_RATE 4
+
+PG_FUNCTION_INFO_V1(latin2_to_mic)
+PG_FUNCTION_INFO_V1(mic_to_latin2)
+PG_FUNCTION_INFO_V1(win1250_to_mic)
+PG_FUNCTION_INFO_V1(mic_to_win1250)
+PG_FUNCTION_INFO_V1(latin2_to_win1250)
+PG_FUNCTION_INFO_V1(win1250_to_latin2)
+
+extern Datum latin2_to_mic(PG_FUNCTION_ARGS);
+extern Datum mic_to_latin2(PG_FUNCTION_ARGS);
+extern Datum win1250_to_mic(PG_FUNCTION_ARGS);
+extern Datum mic_to_win1250(PG_FUNCTION_ARGS);
+extern Datum latin2_to_win1250(PG_FUNCTION_ARGS);
+extern Datum win1250_to_latin2(PG_FUNCTION_ARGS);
+
+/* ----------
+ * conv_proc(
+ * INTEGER, -- source encoding id
+ * INTEGER, -- destination encoding id
+ * OPAQUE, -- source string (null terminated C string)
+ * OPAQUE, -- destination string (null terminated C string)
+ * INTEGER -- source string length
+ * ) returns INTEGER; -- dummy. returns nothing, actually.
+ * ----------
+ */
+
+static void latin22mic(unsigned char *l, unsigned char *p, int len);
+static void mic2latin2(unsigned char *mic, unsigned char *p, int len);
+static void win12502mic(unsigned char *l, unsigned char *p, int len);
+static void mic2win1250(unsigned char *mic, unsigned char *p, int len);
+
+Datum
+latin2_to_mic(PG_FUNCTION_ARGS)
+{
+ unsigned char *src = PG_GETARG_CSTRING(2);
+ unsigned char *dest = PG_GETARG_CSTRING(3);
+ int len = PG_GETARG_INT32(4);
+
+ Assert(PG_GETARG_INT32(0) == PG_LATIN2);
+ Assert(PG_GETARG_INT32(1) == PG_MULE_INTERNAL);
+ Assert(len > 0);
+
+ latin22mic(src, dest, len);
+
+ PG_RETURN_INT32(0);
+}
+
+Datum
+mic_to_latin2(PG_FUNCTION_ARGS)
+{
+ unsigned char *src = PG_GETARG_CSTRING(2);
+ unsigned char *dest = PG_GETARG_CSTRING(3);
+ int len = PG_GETARG_INT32(4);
+
+ Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL);
+ Assert(PG_GETARG_INT32(1) == PG_LATIN2);
+ Assert(len > 0);
+
+ mic2latin2(src, dest, len);
+
+ PG_RETURN_INT32(0);
+}
+
+Datum
+win1250_to_mic(PG_FUNCTION_ARGS)
+{
+ unsigned char *src = PG_GETARG_CSTRING(2);
+ unsigned char *dest = PG_GETARG_CSTRING(3);
+ int len = PG_GETARG_INT32(4);
+
+ Assert(PG_GETARG_INT32(0) == PG_WIN1250);
+ Assert(PG_GETARG_INT32(1) == PG_MULE_INTERNAL);
+ Assert(len > 0);
+
+ win12502mic(src, dest, len);
+
+ PG_RETURN_INT32(0);
+}
+
+Datum
+mic_to_win1250(PG_FUNCTION_ARGS)
+{
+ unsigned char *src = PG_GETARG_CSTRING(2);
+ unsigned char *dest = PG_GETARG_CSTRING(3);
+ int len = PG_GETARG_INT32(4);
+
+ Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL);
+ Assert(PG_GETARG_INT32(1) == PG_WIN1250);
+ Assert(len > 0);
+
+ mic2win1250(src, dest, len);
+
+ PG_RETURN_INT32(0);
+}
+
+Datum
+latin2_to_win1250(PG_FUNCTION_ARGS)
+{
+ unsigned char *src = PG_GETARG_CSTRING(2);
+ unsigned char *dest = PG_GETARG_CSTRING(3);
+ int len = PG_GETARG_INT32(4);
+ unsigned char *buf;
+
+ Assert(PG_GETARG_INT32(0) == PG_LATIN2);
+ Assert(PG_GETARG_INT32(1) == PG_WIN1250);
+ Assert(len > 0);
+
+ buf = palloc(len * ENCODING_GROWTH_RATE);
+ latin22mic(src, buf, len);
+ mic2win1250(buf, dest, strlen(buf));
+ pfree(buf);
+
+ PG_RETURN_INT32(0);
+}
+
+Datum
+win1250_to_latin2(PG_FUNCTION_ARGS)
+{
+ unsigned char *src = PG_GETARG_CSTRING(2);
+ unsigned char *dest = PG_GETARG_CSTRING(3);
+ int len = PG_GETARG_INT32(4);
+ unsigned char *buf;
+
+ Assert(PG_GETARG_INT32(0) == PG_WIN1250);
+ Assert(PG_GETARG_INT32(1) == PG_LATIN2);
+ Assert(len > 0);
+
+ buf = palloc(len * ENCODING_GROWTH_RATE);
+ win12502mic(src, buf, len);
+ mic2latin2(buf, dest, strlen(buf));
+ pfree(buf);
+
+ PG_RETURN_INT32(0);
+}
+
+static void
+latin22mic(unsigned char *l, unsigned char *p, int len)
+{
+ latin2mic(l, p, len, LC_ISO8859_2);
+}
+static void
+mic2latin2(unsigned char *mic, unsigned char *p, int len)
+{
+ mic2latin(mic, p, len, LC_ISO8859_2);
+}
+
+/*-----------------------------------------------------------------
+ * WIN1250
+ * Microsoft's CP1250(windows-1250)
+ *-----------------------------------------------------------------*/
+static void
+win12502mic(unsigned char *l, unsigned char *p, int len)
+{
+ static unsigned char win1250_2_iso88592[] = {
+ 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
+ 0x88, 0x89, 0xA9, 0x8B, 0xA6, 0xAB, 0xAE, 0xAC,
+ 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
+ 0x98, 0x99, 0xB9, 0x9B, 0xB6, 0xBB, 0xBE, 0xBC,
+ 0xA0, 0xB7, 0xA2, 0xA3, 0xA4, 0xA1, 0x00, 0xA7,
+ 0xA8, 0x00, 0xAA, 0x00, 0x00, 0xAD, 0x00, 0xAF,
+ 0xB0, 0x00, 0xB2, 0xB3, 0xB4, 0x00, 0x00, 0x00,
+ 0xB8, 0xB1, 0xBA, 0x00, 0xA5, 0xBD, 0xB5, 0xBF,
+ 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7,
+ 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
+ 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7,
+ 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF,
+ 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
+ 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
+ 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,
+ 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF
+ };
+
+ latin2mic_with_table(l, p, len, LC_ISO8859_2, win1250_2_iso88592);
+}
+static void
+mic2win1250(unsigned char *mic, unsigned char *p, int len)
+{
+ static unsigned char iso88592_2_win1250[] = {
+ 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87,
+ 0x88, 0x89, 0x00, 0x8B, 0x00, 0x00, 0x00, 0x00,
+ 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97,
+ 0x98, 0x99, 0x00, 0x9B, 0x00, 0x00, 0x00, 0x00,
+ 0xA0, 0xA5, 0xA2, 0xA3, 0xA4, 0xBC, 0x8C, 0xA7,
+ 0xA8, 0x8A, 0xAA, 0x8D, 0x8F, 0xAD, 0x8E, 0xAF,
+ 0xB0, 0xB9, 0xB2, 0xB3, 0xB4, 0xBE, 0x9C, 0xA1,
+ 0xB8, 0x9A, 0xBA, 0x9D, 0x9F, 0xBD, 0x9E, 0xBF,
+ 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7,
+ 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF,
+ 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7,
+ 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF,
+ 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7,
+ 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF,
+ 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7,
+ 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF
+ };
+
+ mic2latin_with_table(mic, p, len, LC_ISO8859_2, iso88592_2_win1250);
+}
--- /dev/null
+#-------------------------------------------------------------------------
+#
+# $Id: Makefile,v 1.1 2002/08/14 02:45:10 ishii Exp $
+#
+#-------------------------------------------------------------------------
+top_builddir = ../../../../../..
+include $(top_builddir)/src/Makefile.global
+
+NAME := latin_and_mic
+
+include ../proc.mk
--- /dev/null
+/*-------------------------------------------------------------------------
+ *
+ * LATINn and MULE_INTERNAL
+ *
+ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * IDENTIFICATION
+ * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/latin_and_mic/latin_and_mic.c,v 1.1 2002/08/14 02:45:10 ishii Exp $
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#include "postgres.h"
+#include "fmgr.h"
+#include "mb/pg_wchar.h"
+
+PG_FUNCTION_INFO_V1(latin1_to_mic)
+PG_FUNCTION_INFO_V1(mic_to_latin1)
+PG_FUNCTION_INFO_V1(latin3_to_mic)
+PG_FUNCTION_INFO_V1(mic_to_latin3)
+PG_FUNCTION_INFO_V1(latin4_to_mic)
+PG_FUNCTION_INFO_V1(mic_to_latin4)
+
+extern Datum latin1_to_mic(PG_FUNCTION_ARGS);
+extern Datum mic_to_latin1(PG_FUNCTION_ARGS);
+extern Datum latin3_to_mic(PG_FUNCTION_ARGS);
+extern Datum mic_to_latin3(PG_FUNCTION_ARGS);
+extern Datum latin4_to_mic(PG_FUNCTION_ARGS);
+extern Datum mic_to_latin4(PG_FUNCTION_ARGS);
+
+/* ----------
+ * conv_proc(
+ * INTEGER, -- source encoding id
+ * INTEGER, -- destination encoding id
+ * OPAQUE, -- source string (null terminated C string)
+ * OPAQUE, -- destination string (null terminated C string)
+ * INTEGER -- source string length
+ * ) returns INTEGER; -- dummy. returns nothing, actually.
+ * ----------
+ */
+
+static void latin12mic(unsigned char *l, unsigned char *p, int len);
+static void mic2latin1(unsigned char *mic, unsigned char *p, int len);
+static void latin32mic(unsigned char *l, unsigned char *p, int len);
+static void mic2latin3(unsigned char *mic, unsigned char *p, int len);
+static void latin42mic(unsigned char *l, unsigned char *p, int len);
+static void mic2latin4(unsigned char *mic, unsigned char *p, int len);
+
+Datum
+latin1_to_mic(PG_FUNCTION_ARGS)
+{
+ unsigned char *src = PG_GETARG_CSTRING(2);
+ unsigned char *dest = PG_GETARG_CSTRING(3);
+ int len = PG_GETARG_INT32(4);
+
+ Assert(PG_GETARG_INT32(0) == PG_LATIN1);
+ Assert(PG_GETARG_INT32(1) == PG_MULE_INTERNAL);
+ Assert(len > 0);
+
+ latin12mic(src, dest, len);
+
+ PG_RETURN_INT32(0);
+}
+
+Datum
+mic_to_latin1(PG_FUNCTION_ARGS)
+{
+ unsigned char *src = PG_GETARG_CSTRING(2);
+ unsigned char *dest = PG_GETARG_CSTRING(3);
+ int len = PG_GETARG_INT32(4);
+
+ Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL);
+ Assert(PG_GETARG_INT32(1) == PG_LATIN1);
+ Assert(len > 0);
+
+ mic2latin1(src, dest, len);
+
+ PG_RETURN_INT32(0);
+}
+
+Datum
+latin3_to_mic(PG_FUNCTION_ARGS)
+{
+ unsigned char *src = PG_GETARG_CSTRING(2);
+ unsigned char *dest = PG_GETARG_CSTRING(3);
+ int len = PG_GETARG_INT32(4);
+
+ Assert(PG_GETARG_INT32(0) == PG_LATIN3);
+ Assert(PG_GETARG_INT32(1) == PG_MULE_INTERNAL);
+ Assert(len > 0);
+
+ latin32mic(src, dest, len);
+
+ PG_RETURN_INT32(0);
+}
+
+Datum
+mic_to_latin3(PG_FUNCTION_ARGS)
+{
+ unsigned char *src = PG_GETARG_CSTRING(2);
+ unsigned char *dest = PG_GETARG_CSTRING(3);
+ int len = PG_GETARG_INT32(4);
+
+ Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL);
+ Assert(PG_GETARG_INT32(1) == PG_LATIN3);
+ Assert(len > 0);
+
+ mic2latin3(src, dest, len);
+
+ PG_RETURN_INT32(0);
+}
+
+Datum
+latin4_to_mic(PG_FUNCTION_ARGS)
+{
+ unsigned char *src = PG_GETARG_CSTRING(2);
+ unsigned char *dest = PG_GETARG_CSTRING(3);
+ int len = PG_GETARG_INT32(4);
+
+ Assert(PG_GETARG_INT32(0) == PG_LATIN4);
+ Assert(PG_GETARG_INT32(1) == PG_MULE_INTERNAL);
+ Assert(len > 0);
+
+ latin42mic(src, dest, len);
+
+ PG_RETURN_INT32(0);
+}
+
+Datum mic_to_latin4(PG_FUNCTION_ARGS)
+{
+ unsigned char *src = PG_GETARG_CSTRING(2);
+ unsigned char *dest = PG_GETARG_CSTRING(3);
+ int len = PG_GETARG_INT32(4);
+
+ Assert(PG_GETARG_INT32(0) == PG_MULE_INTERNAL);
+ Assert(PG_GETARG_INT32(1) == PG_LATIN4);
+ Assert(len > 0);
+
+ mic2latin4(src, dest, len);
+
+ PG_RETURN_INT32(0);
+}
+
+static void
+latin12mic(unsigned char *l, unsigned char *p, int len)
+{
+ latin2mic(l, p, len, LC_ISO8859_1);
+}
+static void
+mic2latin1(unsigned char *mic, unsigned char *p, int len)
+{
+ mic2latin(mic, p, len, LC_ISO8859_1);
+}
+static void
+latin32mic(unsigned char *l, unsigned char *p, int len)
+{
+ latin2mic(l, p, len, LC_ISO8859_3);
+}
+static void
+mic2latin3(unsigned char *mic, unsigned char *p, int len)
+{
+ mic2latin(mic, p, len, LC_ISO8859_3);
+}
+static void
+latin42mic(unsigned char *l, unsigned char *p, int len)
+{
+ latin2mic(l, p, len, LC_ISO8859_4);
+}
+static void
+mic2latin4(unsigned char *mic, unsigned char *p, int len)
+{
+ mic2latin(mic, p, len, LC_ISO8859_4);
+}
+
--- /dev/null
+#-------------------------------------------------------------------------
+#
+# $Id: Makefile,v 1.1 2002/08/14 02:45:10 ishii Exp $
+#
+#-------------------------------------------------------------------------
+top_builddir = ../../../../../..
+include $(top_builddir)/src/Makefile.global
+
+NAME := utf8_and_cyrillic
+
+include ../proc.mk
--- /dev/null
+/*-------------------------------------------------------------------------
+ *
+ * UTF8 and Cyrillic
+ *
+ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * IDENTIFICATION
+ * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_cyrillic/utf8_and_cyrillic.c,v 1.1 2002/08/14 02:45:10 ishii Exp $
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#include "postgres.h"
+#include "fmgr.h"
+#include "mb/pg_wchar.h"
+#include "../../Unicode/utf8_to_koi8r.map"
+#include "../../Unicode/koi8r_to_utf8.map"
+#include "../../Unicode/utf8_to_win1251.map"
+#include "../../Unicode/win1251_to_utf8.map"
+#include "../../Unicode/utf8_to_alt.map"
+#include "../../Unicode/alt_to_utf8.map"
+
+PG_FUNCTION_INFO_V1(utf8_to_koi8r)
+PG_FUNCTION_INFO_V1(koi8r_to_utf8)
+PG_FUNCTION_INFO_V1(utf8_to_win1251)
+PG_FUNCTION_INFO_V1(win1251_to_utf8)
+PG_FUNCTION_INFO_V1(utf8_to_alt)
+PG_FUNCTION_INFO_V1(alt_to_utf8)
+
+extern Datum utf8_to_koi8r(PG_FUNCTION_ARGS);
+extern Datum koi8r_to_utf8(PG_FUNCTION_ARGS);
+extern Datum utf8_to_win1251(PG_FUNCTION_ARGS);
+extern Datum win1251_to_utf8(PG_FUNCTION_ARGS);
+extern Datum utf8_to_alt(PG_FUNCTION_ARGS);
+extern Datum alt_to_utf8(PG_FUNCTION_ARGS);
+
+/* ----------
+ * conv_proc(
+ * INTEGER, -- source encoding id
+ * INTEGER, -- destination encoding id
+ * OPAQUE, -- source string (null terminated C string)
+ * OPAQUE, -- destination string (null terminated C string)
+ * INTEGER -- source string length
+ * ) returns INTEGER; -- dummy. returns nothing, actually.
+ * ----------
+ */
+
+Datum
+utf8_to_koi8r(PG_FUNCTION_ARGS)
+{
+ unsigned char *src = PG_GETARG_CSTRING(2);
+ unsigned char *dest = PG_GETARG_CSTRING(3);
+ int len = PG_GETARG_INT32(4);
+
+ Assert(PG_GETARG_INT32(0) == PG_UTF8);
+ Assert(PG_GETARG_INT32(1) == PG_KOI8R);
+ Assert(len > 0);
+
+ UtfToLocal(src, dest, ULmap_KOI8R,
+ sizeof(ULmap_KOI8R) / sizeof(pg_utf_to_local), len);
+
+ PG_RETURN_INT32(0);
+}
+
+Datum
+koi8r_to_utf8(PG_FUNCTION_ARGS)
+{
+ unsigned char *src = PG_GETARG_CSTRING(2);
+ unsigned char *dest = PG_GETARG_CSTRING(3);
+ int len = PG_GETARG_INT32(4);
+
+ Assert(PG_GETARG_INT32(0) == PG_KOI8R);
+ Assert(PG_GETARG_INT32(1) == PG_UTF8);
+ Assert(len > 0);
+
+ LocalToUtf(src, dest, LUmapKOI8R,
+ sizeof(LUmapKOI8R) / sizeof(pg_local_to_utf), PG_KOI8R, len);
+
+ PG_RETURN_INT32(0);
+}
+
+Datum
+utf8_to_win1251(PG_FUNCTION_ARGS)
+{
+ unsigned char *src = PG_GETARG_CSTRING(2);
+ unsigned char *dest = PG_GETARG_CSTRING(3);
+ int len = PG_GETARG_INT32(4);
+
+ Assert(PG_GETARG_INT32(0) == PG_UTF8);
+ Assert(PG_GETARG_INT32(1) == PG_WIN1251);
+ Assert(len > 0);
+
+ UtfToLocal(src, dest, ULmap_WIN1251,
+ sizeof(ULmap_WIN1251) / sizeof(pg_utf_to_local), len);
+
+ PG_RETURN_INT32(0);
+}
+
+Datum
+win1251_to_utf8(PG_FUNCTION_ARGS)
+{
+ unsigned char *src = PG_GETARG_CSTRING(2);
+ unsigned char *dest = PG_GETARG_CSTRING(3);
+ int len = PG_GETARG_INT32(4);
+
+ Assert(PG_GETARG_INT32(0) == PG_WIN1251);
+ Assert(PG_GETARG_INT32(1) == PG_UTF8);
+ Assert(len > 0);
+
+ LocalToUtf(src, dest, LUmapWIN1251,
+ sizeof(LUmapWIN1251) / sizeof(pg_local_to_utf), PG_WIN1251, len);
+
+ PG_RETURN_INT32(0);
+}
+
+Datum
+utf8_to_alt(PG_FUNCTION_ARGS)
+{
+ unsigned char *src = PG_GETARG_CSTRING(2);
+ unsigned char *dest = PG_GETARG_CSTRING(3);
+ int len = PG_GETARG_INT32(4);
+
+ Assert(PG_GETARG_INT32(0) == PG_UTF8);
+ Assert(PG_GETARG_INT32(1) == PG_ALT);
+ Assert(len > 0);
+
+ UtfToLocal(src, dest, ULmap_ALT,
+ sizeof(ULmap_ALT) / sizeof(pg_utf_to_local), len);
+
+ PG_RETURN_INT32(0);
+}
+
+Datum
+alt_to_utf8(PG_FUNCTION_ARGS)
+{
+ unsigned char *src = PG_GETARG_CSTRING(2);
+ unsigned char *dest = PG_GETARG_CSTRING(3);
+ int len = PG_GETARG_INT32(4);
+
+ Assert(PG_GETARG_INT32(0) == PG_ALT);
+ Assert(PG_GETARG_INT32(1) == PG_UTF8);
+ Assert(len > 0);
+
+ LocalToUtf(src, dest, LUmapALT,
+ sizeof(LUmapALT) / sizeof(pg_local_to_utf), PG_ALT, len);
+
+ PG_RETURN_INT32(0);
+}
--- /dev/null
+#-------------------------------------------------------------------------
+#
+# $Id: Makefile,v 1.1 2002/08/14 02:45:10 ishii Exp $
+#
+#-------------------------------------------------------------------------
+top_builddir = ../../../../../..
+include $(top_builddir)/src/Makefile.global
+
+NAME := utf8_and_win1250
+
+include ../proc.mk
--- /dev/null
+/*-------------------------------------------------------------------------
+ *
+ * WIN1250 and UTF-8
+ *
+ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * IDENTIFICATION
+ * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win1250/Attic/utf8_and_win1250.c,v 1.1 2002/08/14 02:45:10 ishii Exp $
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#include "postgres.h"
+#include "fmgr.h"
+#include "mb/pg_wchar.h"
+#include "../../Unicode/utf8_to_win1250.map"
+#include "../../Unicode/win1250_to_utf8.map"
+
+PG_FUNCTION_INFO_V1(utf_to_win1250)
+PG_FUNCTION_INFO_V1(win1250_to_utf)
+
+extern Datum utf_to_win1250(PG_FUNCTION_ARGS);
+extern Datum win1250_to_utf(PG_FUNCTION_ARGS);
+
+/* ----------
+ * conv_proc(
+ * INTEGER, -- source encoding id
+ * INTEGER, -- destination encoding id
+ * OPAQUE, -- source string (null terminated C string)
+ * OPAQUE, -- destination string (null terminated C string)
+ * INTEGER -- source string length
+ * ) returns INTEGER; -- dummy. returns nothing, actually.
+ * ----------
+ */
+
+Datum
+utf_to_win1250(PG_FUNCTION_ARGS)
+{
+ unsigned char *src = PG_GETARG_CSTRING(2);
+ unsigned char *dest = PG_GETARG_CSTRING(3);
+ int len = PG_GETARG_INT32(4);
+
+ Assert(PG_GETARG_INT32(0) == PG_UTF8);
+ Assert(PG_GETARG_INT32(1) == PG_WIN1250);
+ Assert(len > 0);
+
+ UtfToLocal(src, dest, ULmapWIN1250,
+ sizeof(ULmapWIN1250) / sizeof(pg_utf_to_local), len);
+
+ PG_RETURN_INT32(0);
+}
+
+Datum
+win1250_to_utf(PG_FUNCTION_ARGS)
+{
+ unsigned char *src = PG_GETARG_CSTRING(2);
+ unsigned char *dest = PG_GETARG_CSTRING(3);
+ int len = PG_GETARG_INT32(4);
+
+ Assert(PG_GETARG_INT32(0) == PG_WIN1250);
+ Assert(PG_GETARG_INT32(1) == PG_UTF8);
+ Assert(len > 0);
+
+ LocalToUtf(src, dest, LUmapWIN1250,
+ sizeof(LUmapWIN1250) / sizeof(pg_local_to_utf), PG_WIN1250, len);
+
+ PG_RETURN_INT32(0);
+}
--- /dev/null
+#-------------------------------------------------------------------------
+#
+# $Id: Makefile,v 1.1 2002/08/14 02:45:10 ishii Exp $
+#
+#-------------------------------------------------------------------------
+top_builddir = ../../../../../..
+include $(top_builddir)/src/Makefile.global
+
+NAME := utf8_and_win1256
+
+include ../proc.mk
--- /dev/null
+/*-------------------------------------------------------------------------
+ *
+ * WIN1256 and UTF-8
+ *
+ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * IDENTIFICATION
+ * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win1256/Attic/utf8_and_win1256.c,v 1.1 2002/08/14 02:45:10 ishii Exp $
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#include "postgres.h"
+#include "fmgr.h"
+#include "mb/pg_wchar.h"
+#include "../../Unicode/utf8_to_win1256.map"
+#include "../../Unicode/win1256_to_utf8.map"
+
+PG_FUNCTION_INFO_V1(utf_to_win1256)
+PG_FUNCTION_INFO_V1(win1256_to_utf)
+
+extern Datum utf_to_win1256(PG_FUNCTION_ARGS);
+extern Datum win1256_to_utf(PG_FUNCTION_ARGS);
+
+/* ----------
+ * conv_proc(
+ * INTEGER, -- source encoding id
+ * INTEGER, -- destination encoding id
+ * OPAQUE, -- source string (null terminated C string)
+ * OPAQUE, -- destination string (null terminated C string)
+ * INTEGER -- source string length
+ * ) returns INTEGER; -- dummy. returns nothing, actually.
+ * ----------
+ */
+
+Datum
+utf_to_win1256(PG_FUNCTION_ARGS)
+{
+ unsigned char *src = PG_GETARG_CSTRING(2);
+ unsigned char *dest = PG_GETARG_CSTRING(3);
+ int len = PG_GETARG_INT32(4);
+
+ Assert(PG_GETARG_INT32(0) == PG_UTF8);
+ Assert(PG_GETARG_INT32(1) == PG_WIN1256);
+ Assert(len > 0);
+
+ UtfToLocal(src, dest, ULmapWIN1256,
+ sizeof(ULmapWIN1256) / sizeof(pg_utf_to_local), len);
+
+ PG_RETURN_INT32(0);
+}
+
+Datum
+win1256_to_utf(PG_FUNCTION_ARGS)
+{
+ unsigned char *src = PG_GETARG_CSTRING(2);
+ unsigned char *dest = PG_GETARG_CSTRING(3);
+ int len = PG_GETARG_INT32(4);
+
+ Assert(PG_GETARG_INT32(0) == PG_WIN1256);
+ Assert(PG_GETARG_INT32(1) == PG_UTF8);
+ Assert(len > 0);
+
+ LocalToUtf(src, dest, LUmapWIN1256,
+ sizeof(LUmapWIN1256) / sizeof(pg_local_to_utf), PG_WIN1256, len);
+
+ PG_RETURN_INT32(0);
+}
--- /dev/null
+#-------------------------------------------------------------------------
+#
+# $Id: Makefile,v 1.1 2002/08/14 02:45:10 ishii Exp $
+#
+#-------------------------------------------------------------------------
+top_builddir = ../../../../../..
+include $(top_builddir)/src/Makefile.global
+
+NAME := utf8_and_win874
+
+include ../proc.mk
--- /dev/null
+/*-------------------------------------------------------------------------
+ *
+ * WIN874 and UTF-8
+ *
+ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1994, Regents of the University of California
+ *
+ * IDENTIFICATION
+ * $Header: /cvsroot/pgsql/src/backend/utils/mb/conversion_procs/utf8_and_win874/Attic/utf8_and_win874.c,v 1.1 2002/08/14 02:45:10 ishii Exp $
+ *
+ *-------------------------------------------------------------------------
+ */
+
+#include "postgres.h"
+#include "fmgr.h"
+#include "mb/pg_wchar.h"
+#include "../../Unicode/utf8_to_win874.map"
+#include "../../Unicode/win874_to_utf8.map"
+
+PG_FUNCTION_INFO_V1(utf_to_win874)
+PG_FUNCTION_INFO_V1(win874_to_utf)
+
+extern Datum utf_to_win874(PG_FUNCTION_ARGS);
+extern Datum win874_to_utf(PG_FUNCTION_ARGS);
+
+/* ----------
+ * conv_proc(
+ * INTEGER, -- source encoding id
+ * INTEGER, -- destination encoding id
+ * OPAQUE, -- source string (null terminated C string)
+ * OPAQUE, -- destination string (null terminated C string)
+ * INTEGER -- source string length
+ * ) returns INTEGER; -- dummy. returns nothing, actually.
+ * ----------
+ */
+
+Datum
+utf_to_win874(PG_FUNCTION_ARGS)
+{
+ unsigned char *src = PG_GETARG_CSTRING(2);
+ unsigned char *dest = PG_GETARG_CSTRING(3);
+ int len = PG_GETARG_INT32(4);
+
+ Assert(PG_GETARG_INT32(0) == PG_UTF8);
+ Assert(PG_GETARG_INT32(1) == PG_WIN874);
+ Assert(len > 0);
+
+ UtfToLocal(src, dest, ULmapWIN874,
+ sizeof(ULmapWIN874) / sizeof(pg_utf_to_local), len);
+
+ PG_RETURN_INT32(0);
+}
+
+Datum
+win874_to_utf(PG_FUNCTION_ARGS)
+{
+ unsigned char *src = PG_GETARG_CSTRING(2);
+ unsigned char *dest = PG_GETARG_CSTRING(3);
+ int len = PG_GETARG_INT32(4);
+
+ Assert(PG_GETARG_INT32(0) == PG_WIN874);
+ Assert(PG_GETARG_INT32(1) == PG_UTF8);
+ Assert(len > 0);
+
+ LocalToUtf(src, dest, LUmapWIN874,
+ sizeof(LUmapWIN874) / sizeof(pg_local_to_utf), PG_WIN874, len);
+
+ PG_RETURN_INT32(0);
+}
-/* $Id: pg_wchar.h,v 1.41 2002/07/29 08:04:55 ishii Exp $ */
+/* $Id: pg_wchar.h,v 1.42 2002/08/14 02:45:10 ishii Exp $ */
#ifndef PG_WCHAR_H
#define PG_WCHAR_H
extern void pg_ascii2mic(unsigned char *src, unsigned char *dest, int len);
extern void pg_mic2ascii(unsigned char *src, unsigned char *dest, int len);
extern void pg_print_bogus_char(unsigned char **mic, unsigned char **p);
+extern void latin2mic(unsigned char *l, unsigned char *p, int len, int lc);
+extern void mic2latin(unsigned char *mic, unsigned char *p, int len, int lc);
+extern void latin2mic_with_table(unsigned char *l, unsigned char *p, int len, int lc, unsigned char *tab);
+extern void mic2latin_with_table(unsigned char *mic, unsigned char *p, int len, int lc, unsigned char *tab);
#endif /* PG_WCHAR_H */
DROP CONVERSION mydef;
--
-- make sure all pre-defined conversions are fine.
--- UNICODE --> SQL_ASCII
-SELECT CONVERT('foo' USING utf8_to_ascii);
+-- SQL_ASCII --> MULE_INTERNAL
+SELECT CONVERT('foo' USING ascii_to_mic);
+ convert
+---------
+ foo
+(1 row)
+
+SELECT CONVERT('foo', 'SQL_ASCII', 'MULE_INTERNAL');
+ convert
+---------
+ foo
+(1 row)
+
+-- MULE_INTERNAL --> SQL_ASCII
+SELECT CONVERT('foo' USING mic_to_ascii);
+ convert
+---------
+ foo
+(1 row)
+
+SELECT CONVERT('foo', 'MULE_INTERNAL', 'SQL_ASCII');
+ convert
+---------
+ foo
+(1 row)
+
+-- KOI8R --> MULE_INTERNAL
+SELECT CONVERT('foo' USING koi8r_to_mic);
+ convert
+---------
+ foo
+(1 row)
+
+SELECT CONVERT('foo', 'KOI8R', 'MULE_INTERNAL');
+ convert
+---------
+ foo
+(1 row)
+
+-- MULE_INTERNAL --> KOI8R
+SELECT CONVERT('foo' USING mic_to_koi8r);
+ convert
+---------
+ foo
+(1 row)
+
+SELECT CONVERT('foo', 'MULE_INTERNAL', 'KOI8R');
+ convert
+---------
+ foo
+(1 row)
+
+-- ISO-8859-5 --> MULE_INTERNAL
+SELECT CONVERT('foo' USING iso_8859_5_to_mic);
+ convert
+---------
+ foo
+(1 row)
+
+SELECT CONVERT('foo', 'ISO-8859-5', 'MULE_INTERNAL');
+ convert
+---------
+ foo
+(1 row)
+
+-- MULE_INTERNAL --> ISO-8859-5
+SELECT CONVERT('foo' USING mic_to_iso_8859_5);
+ convert
+---------
+ foo
+(1 row)
+
+SELECT CONVERT('foo', 'MULE_INTERNAL', 'ISO-8859-5');
+ convert
+---------
+ foo
+(1 row)
+
+-- WIN1251 --> MULE_INTERNAL
+SELECT CONVERT('foo' USING win1251_to_mic);
+ convert
+---------
+ foo
+(1 row)
+
+SELECT CONVERT('foo', 'WIN1251', 'MULE_INTERNAL');
+ convert
+---------
+ foo
+(1 row)
+
+-- MULE_INTERNAL --> WIN1251
+SELECT CONVERT('foo' USING mic_to_win1251);
+ convert
+---------
+ foo
+(1 row)
+
+SELECT CONVERT('foo', 'MULE_INTERNAL', 'WIN1251');
+ convert
+---------
+ foo
+(1 row)
+
+-- ALT --> MULE_INTERNAL
+SELECT CONVERT('foo' USING win866_to_mic);
+ convert
+---------
+ foo
+(1 row)
+
+SELECT CONVERT('foo', 'ALT', 'MULE_INTERNAL');
+ convert
+---------
+ foo
+(1 row)
+
+-- MULE_INTERNAL --> ALT
+SELECT CONVERT('foo' USING mic_to_win866);
+ convert
+---------
+ foo
+(1 row)
+
+SELECT CONVERT('foo', 'MULE_INTERNAL', 'ALT');
+ convert
+---------
+ foo
+(1 row)
+
+-- KOI8R --> WIN1251
+SELECT CONVERT('foo' USING koi8r_to_win1251);
+ convert
+---------
+ foo
+(1 row)
+
+SELECT CONVERT('foo', 'KOI8R', 'WIN1251');
+ convert
+---------
+ foo
+(1 row)
+
+-- WIN1251 --> KOI8R
+SELECT CONVERT('foo' USING win1251_to_koi8r);
+ convert
+---------
+ foo
+(1 row)
+
+SELECT CONVERT('foo', 'WIN1251', 'KOI8R');
+ convert
+---------
+ foo
+(1 row)
+
+-- KOI8R --> ALT
+SELECT CONVERT('foo' USING koi8r_to_win866);
+ convert
+---------
+ foo
+(1 row)
+
+SELECT CONVERT('foo', 'KOI8R', 'ALT');
+ convert
+---------
+ foo
+(1 row)
+
+-- ALT --> KOI8R
+SELECT CONVERT('foo' USING win866_to_koi8r);
+ convert
+---------
+ foo
+(1 row)
+
+SELECT CONVERT('foo', 'ALT', 'KOI8R');
+ convert
+---------
+ foo
+(1 row)
+
+-- ALT --> WIN1251
+SELECT CONVERT('foo' USING win866_to_win1251);
+ convert
+---------
+ foo
+(1 row)
+
+SELECT CONVERT('foo', 'ALT', 'WIN1251');
+ convert
+---------
+ foo
+(1 row)
+
+-- WIN1251 --> ALT
+SELECT CONVERT('foo' USING win1251_to_win866);
+ convert
+---------
+ foo
+(1 row)
+
+SELECT CONVERT('foo', 'WIN1251', 'ALT');
+ convert
+---------
+ foo
+(1 row)
+
+-- ISO-8859-5 --> KOI8R
+SELECT CONVERT('foo' USING iso_8859_5_to_koi8r);
+ convert
+---------
+ foo
+(1 row)
+
+SELECT CONVERT('foo', 'ISO-8859-5', 'KOI8R');
+ convert
+---------
+ foo
+(1 row)
+
+-- KOI8R --> ISO-8859-5
+SELECT CONVERT('foo' USING koi8r_to_iso_8859_5);
+ convert
+---------
+ foo
+(1 row)
+
+SELECT CONVERT('foo', 'KOI8R', 'ISO-8859-5');
+ convert
+---------
+ foo
+(1 row)
+
+-- ISO-8859-5 --> WIN1251
+SELECT CONVERT('foo' USING iso_8859_5_to_win1251);
+ convert
+---------
+ foo
+(1 row)
+
+SELECT CONVERT('foo', 'ISO-8859-5', 'WIN1251');
+ convert
+---------
+ foo
+(1 row)
+
+-- WIN1251 --> ISO-8859-5
+SELECT CONVERT('foo' USING win1251_to_iso_8859_5);
+ convert
+---------
+ foo
+(1 row)
+
+SELECT CONVERT('foo', 'WIN1251', 'ISO-8859-5');
+ convert
+---------
+ foo
+(1 row)
+
+-- ISO-8859-5 --> ALT
+SELECT CONVERT('foo' USING iso_8859_5_to_win866);
+ convert
+---------
+ foo
+(1 row)
+
+SELECT CONVERT('foo', 'ISO-8859-5', 'ALT');
+ convert
+---------
+ foo
+(1 row)
+
+-- ALT --> ISO-8859-5
+SELECT CONVERT('foo' USING win866_to_iso_8859_5);
+ convert
+---------
+ foo
+(1 row)
+
+SELECT CONVERT('foo', 'ALT', 'ISO-8859-5');
+ convert
+---------
+ foo
+(1 row)
+
+-- EUC_CN --> MULE_INTERNAL
+SELECT CONVERT('foo' USING euc_cn_to_mic);
+ convert
+---------
+ foo
+(1 row)
+
+SELECT CONVERT('foo', 'EUC_CN', 'MULE_INTERNAL');
+ convert
+---------
+ foo
+(1 row)
+
+-- MULE_INTERNAL --> EUC_CN
+SELECT CONVERT('foo' USING mic_to_euc_cn);
+ convert
+---------
+ foo
+(1 row)
+
+SELECT CONVERT('foo', 'MULE_INTERNAL', 'EUC_CN');
+ convert
+---------
+ foo
+(1 row)
+
+-- EUC_JP --> SJIS
+SELECT CONVERT('foo' USING euc_jp_to_sjis);
+ convert
+---------
+ foo
+(1 row)
+
+SELECT CONVERT('foo', 'EUC_JP', 'SJIS');
+ convert
+---------
+ foo
+(1 row)
+
+-- SJIS --> EUC_JP
+SELECT CONVERT('foo' USING sjis_to_euc_jp);
+ convert
+---------
+ foo
+(1 row)
+
+SELECT CONVERT('foo', 'SJIS', 'EUC_JP');
+ convert
+---------
+ foo
+(1 row)
+
+-- EUC_JP --> MULE_INTERNAL
+SELECT CONVERT('foo' USING euc_jp_to_mic);
+ convert
+---------
+ foo
+(1 row)
+
+SELECT CONVERT('foo', 'EUC_JP', 'MULE_INTERNAL');
+ convert
+---------
+ foo
+(1 row)
+
+-- SJIS --> MULE_INTERNAL
+SELECT CONVERT('foo' USING sjis_to_mic);
+ convert
+---------
+ foo
+(1 row)
+
+SELECT CONVERT('foo', 'SJIS', 'MULE_INTERNAL');
+ convert
+---------
+ foo
+(1 row)
+
+-- MULE_INTERNAL --> EUC_JP
+SELECT CONVERT('foo' USING mic_to_euc_jp);
+ convert
+---------
+ foo
+(1 row)
+
+SELECT CONVERT('foo', 'MULE_INTERNAL', 'EUC_JP');
+ convert
+---------
+ foo
+(1 row)
+
+-- MULE_INTERNAL --> SJIS
+SELECT CONVERT('foo' USING mic_to_sjis);
+ convert
+---------
+ foo
+(1 row)
+
+SELECT CONVERT('foo', 'MULE_INTERNAL', 'SJIS');
+ convert
+---------
+ foo
+(1 row)
+
+-- EUC_KR --> MULE_INTERNAL
+SELECT CONVERT('foo' USING euc_kr_to_mic);
+ convert
+---------
+ foo
+(1 row)
+
+SELECT CONVERT('foo', 'EUC_KR', 'MULE_INTERNAL');
+ convert
+---------
+ foo
+(1 row)
+
+-- MULE_INTERNAL --> EUC_KR
+SELECT CONVERT('foo' USING mic_to_euc_kr);
+ convert
+---------
+ foo
+(1 row)
+
+SELECT CONVERT('foo', 'MULE_INTERNAL', 'EUC_KR');
+ convert
+---------
+ foo
+(1 row)
+
+-- EUC_TW --> BIG5
+SELECT CONVERT('foo' USING euc_tw_to_big5);
+ convert
+---------
+ foo
+(1 row)
+
+SELECT CONVERT('foo', 'EUC_TW', 'BIG5');
+ convert
+---------
+ foo
+(1 row)
+
+-- BIG5 --> EUC_TW
+SELECT CONVERT('foo' USING big5_to_euc_tw);
+ convert
+---------
+ foo
+(1 row)
+
+SELECT CONVERT('foo', 'BIG5', 'EUC_TW');
+ convert
+---------
+ foo
+(1 row)
+
+-- EUC_TW --> MULE_INTERNAL
+SELECT CONVERT('foo' USING euc_tw_to_mic);
+ convert
+---------
+ foo
+(1 row)
+
+SELECT CONVERT('foo', 'EUC_TW', 'MULE_INTERNAL');
+ convert
+---------
+ foo
+(1 row)
+
+-- BIG5 --> MULE_INTERNAL
+SELECT CONVERT('foo' USING big5_to_mic);
+ convert
+---------
+ foo
+(1 row)
+
+SELECT CONVERT('foo', 'BIG5', 'MULE_INTERNAL');
+ convert
+---------
+ foo
+(1 row)
+
+-- MULE_INTERNAL --> EUC_TW
+SELECT CONVERT('foo' USING mic_to_euc_tw);
+ convert
+---------
+ foo
+(1 row)
+
+SELECT CONVERT('foo', 'MULE_INTERNAL', 'EUC_TW');
+ convert
+---------
+ foo
+(1 row)
+
+-- MULE_INTERNAL --> BIG5
+SELECT CONVERT('foo' USING mic_to_big5);
+ convert
+---------
+ foo
+(1 row)
+
+SELECT CONVERT('foo', 'MULE_INTERNAL', 'BIG5');
convert
---------
foo
(1 row)
-SELECT CONVERT('foo', 'UNICODE', 'SQL_ASCII');
+-- LATIN2 --> MULE_INTERNAL
+SELECT CONVERT('foo' USING iso_8859_2_to_mic);
convert
---------
foo
(1 row)
--- SQL_ASCII --> UNICODE
-SELECT CONVERT('foo' USING ascii_to_utf8);
+SELECT CONVERT('foo', 'LATIN2', 'MULE_INTERNAL');
convert
---------
foo
(1 row)
-SELECT CONVERT('foo', 'SQL_ASCII', 'UNICODE');
+-- MULE_INTERNAL --> LATIN2
+SELECT CONVERT('foo' USING mic_to_iso_8859_2);
convert
---------
foo
(1 row)
--- UNICODE --> LATIN1
-SELECT CONVERT('foo' USING utf8_to_iso8859_1);
+SELECT CONVERT('foo', 'MULE_INTERNAL', 'LATIN2');
convert
---------
foo
(1 row)
-SELECT CONVERT('foo', 'UNICODE', 'LATIN1');
+-- WIN1250 --> MULE_INTERNAL
+SELECT CONVERT('foo' USING win1250_to_mic);
convert
---------
foo
(1 row)
--- LATIN1 --> UNICODE
-SELECT CONVERT('foo' USING iso8859_1_to_utf8);
+SELECT CONVERT('foo', 'WIN1250', 'MULE_INTERNAL');
convert
---------
foo
(1 row)
-SELECT CONVERT('foo', 'LATIN1', 'UNICODE');
+-- MULE_INTERNAL --> WIN1250
+SELECT CONVERT('foo' USING mic_to_win1250);
convert
---------
foo
(1 row)
--- EUC_JP --> UNICODE
-SELECT CONVERT('foo' USING euc_jp_to_utf8);
+SELECT CONVERT('foo', 'MULE_INTERNAL', 'WIN1250');
convert
---------
foo
(1 row)
-SELECT CONVERT('foo', 'EUC_JP', 'UNICODE');
+-- LATIN2 --> WIN1250
+SELECT CONVERT('foo' USING iso_8859_2_to_win1250);
convert
---------
foo
(1 row)
--- UNICODE --> EUC_JP
-SELECT CONVERT('foo' USING utf8_to_euc_jp);
+SELECT CONVERT('foo', 'LATIN2', 'WIN1250');
convert
---------
foo
(1 row)
-SELECT CONVERT('foo', 'UNICODE', 'EUC_JP');
+-- WIN1250 --> LATIN2
+SELECT CONVERT('foo' USING win1250_to_iso_8859_2);
convert
---------
foo
(1 row)
--- EUC_KR --> UNICODE
-SELECT CONVERT('foo' USING euc_kr_to_utf8);
+SELECT CONVERT('foo', 'WIN1250', 'LATIN2');
convert
---------
foo
(1 row)
-SELECT CONVERT('foo', 'EUC_KR', 'UNICODE');
+-- LATIN1 --> MULE_INTERNAL
+SELECT CONVERT('foo' USING iso_8859_1_to_mic);
convert
---------
foo
(1 row)
--- UNICODE --> EUC_KR
-SELECT CONVERT('foo' USING utf8_to_euc_kr);
+SELECT CONVERT('foo', 'LATIN1', 'MULE_INTERNAL');
convert
---------
foo
(1 row)
-SELECT CONVERT('foo', 'UNICODE', 'EUC_KR');
+-- MULE_INTERNAL --> LATIN1
+SELECT CONVERT('foo' USING mic_to_iso_8859_1);
convert
---------
foo
(1 row)
--- EUC_CN --> UNICODE
-SELECT CONVERT('foo' USING euc_cn_to_utf8);
+SELECT CONVERT('foo', 'MULE_INTERNAL', 'LATIN1');
convert
---------
foo
(1 row)
-SELECT CONVERT('foo', 'EUC_CN', 'UNICODE');
+-- LATIN3 --> MULE_INTERNAL
+SELECT CONVERT('foo' USING iso_8859_3_to_mic);
convert
---------
foo
(1 row)
--- UNICODE --> EUC_CN
-SELECT CONVERT('foo' USING utf8_to_euc_cn);
+SELECT CONVERT('foo', 'LATIN3', 'MULE_INTERNAL');
convert
---------
foo
(1 row)
-SELECT CONVERT('foo', 'UNICODE', 'EUC_CN');
+-- MULE_INTERNAL --> LATIN3
+SELECT CONVERT('foo' USING mic_to_iso_8859_3);
convert
---------
foo
(1 row)
--- EUC_TW --> UNICODE
-SELECT CONVERT('foo' USING euc_tw_to_utf8);
+SELECT CONVERT('foo', 'MULE_INTERNAL', 'LATIN3');
convert
---------
foo
(1 row)
-SELECT CONVERT('foo', 'EUC_TW', 'UNICODE');
+-- LATIN4 --> MULE_INTERNAL
+SELECT CONVERT('foo' USING iso_8859_4_to_mic);
convert
---------
foo
(1 row)
--- UNICODE --> EUC_TW
-SELECT CONVERT('foo' USING utf8_to_euc_tw);
+SELECT CONVERT('foo', 'LATIN4', 'MULE_INTERNAL');
convert
---------
foo
(1 row)
-SELECT CONVERT('foo', 'UNICODE', 'EUC_TW');
+-- MULE_INTERNAL --> LATIN4
+SELECT CONVERT('foo' USING mic_to_iso_8859_4);
convert
---------
foo
(1 row)
--- SJIS --> UNICODE
-SELECT CONVERT('foo' USING sjis_to_utf8);
+SELECT CONVERT('foo', 'MULE_INTERNAL', 'LATIN4');
convert
---------
foo
(1 row)
-SELECT CONVERT('foo', 'SJIS', 'UNICODE');
+-- SQL_ASCII --> UNICODE
+SELECT CONVERT('foo' USING ascii_to_utf_8);
convert
---------
foo
(1 row)
--- UNICODE --> SJIS
-SELECT CONVERT('foo' USING utf8_to_sjis);
+SELECT CONVERT('foo', 'SQL_ASCII', 'UNICODE');
convert
---------
foo
(1 row)
-SELECT CONVERT('foo', 'UNICODE', 'SJIS');
+-- UNICODE --> SQL_ASCII
+SELECT CONVERT('foo' USING utf_8_to_ascii);
+ convert
+---------
+ foo
+(1 row)
+
+SELECT CONVERT('foo', 'UNICODE', 'SQL_ASCII');
convert
---------
foo
(1 row)
-- BIG5 --> UNICODE
-SELECT CONVERT('foo' USING big5_to_utf8);
+SELECT CONVERT('foo' USING big5_to_utf_8);
convert
---------
foo
(1 row)
-- UNICODE --> BIG5
-SELECT CONVERT('foo' USING utf8_to_big5);
+SELECT CONVERT('foo' USING utf_8_to_big5);
convert
---------
foo
foo
(1 row)
--- GBK --> UNICODE
-SELECT CONVERT('foo' USING gbk_to_utf8);
+-- UNICODE --> KOI8R
+SELECT CONVERT('foo' USING utf_8_to_koi8r);
convert
---------
foo
(1 row)
-SELECT CONVERT('foo', 'GBK', 'UNICODE');
+SELECT CONVERT('foo', 'UNICODE', 'KOI8R');
convert
---------
foo
(1 row)
--- UNICODE --> GBK
-SELECT CONVERT('foo' USING utf8_to_gbk);
+-- KOI8R --> UNICODE
+SELECT CONVERT('foo' USING koi8r_to_utf_8);
convert
---------
foo
(1 row)
-SELECT CONVERT('foo', 'UNICODE', 'GBK');
+SELECT CONVERT('foo', 'KOI8R', 'UNICODE');
convert
---------
foo
(1 row)
--- GB18030 --> UNICODE
-SELECT CONVERT('foo' USING gb18030_to_utf8);
+-- UNICODE --> WIN1251
+SELECT CONVERT('foo' USING utf_8_to_win1251);
convert
---------
foo
(1 row)
-SELECT CONVERT('foo', 'GB18030', 'UNICODE');
+SELECT CONVERT('foo', 'UNICODE', 'WIN1251');
convert
---------
foo
(1 row)
--- UNICODE --> GB18030
-SELECT CONVERT('foo' USING utf8_to_gb18030);
+-- WIN1251 --> UNICODE
+SELECT CONVERT('foo' USING win1251_to_utf_8);
convert
---------
foo
(1 row)
-SELECT CONVERT('foo', 'UNICODE', 'GB18030');
+SELECT CONVERT('foo', 'WIN1251', 'UNICODE');
convert
---------
foo
(1 row)
--- UHC --> UNICODE
-SELECT CONVERT('foo' USING uhc_to_utf8);
+-- UNICODE --> ALT
+SELECT CONVERT('foo' USING utf_8_to_win866);
convert
---------
foo
(1 row)
-SELECT CONVERT('foo', 'UHC', 'UNICODE');
+SELECT CONVERT('foo', 'UNICODE', 'ALT');
convert
---------
foo
(1 row)
--- UNICODE --> UHC
-SELECT CONVERT('foo' USING utf8_to_uhc);
+-- ALT --> UNICODE
+SELECT CONVERT('foo' USING win866_to_utf_8);
convert
---------
foo
(1 row)
-SELECT CONVERT('foo', 'UNICODE', 'UHC');
+SELECT CONVERT('foo', 'ALT', 'UNICODE');
convert
---------
foo
(1 row)
--- JOHAB --> UNICODE
-SELECT CONVERT('foo' USING johab_to_utf8);
+-- EUC_CN --> UNICODE
+SELECT CONVERT('foo' USING euc_cn_to_utf_8);
convert
---------
foo
(1 row)
-SELECT CONVERT('foo', 'JOHAB', 'UNICODE');
+SELECT CONVERT('foo', 'EUC_CN', 'UNICODE');
convert
---------
foo
(1 row)
--- UNICODE --> JOHAB
-SELECT CONVERT('foo' USING utf8_to_johab);
+-- UNICODE --> EUC_CN
+SELECT CONVERT('foo' USING utf_8_to_euc_cn);
convert
---------
foo
(1 row)
-SELECT CONVERT('foo', 'UNICODE', 'JOHAB');
+SELECT CONVERT('foo', 'UNICODE', 'EUC_CN');
convert
---------
foo
(1 row)
--- TCVN --> UNICODE
-SELECT CONVERT('foo' USING tcvn_to_utf8);
+-- EUC_JP --> UNICODE
+SELECT CONVERT('foo' USING euc_jp_to_utf_8);
convert
---------
foo
(1 row)
-SELECT CONVERT('foo', 'TCVN', 'UNICODE');
+SELECT CONVERT('foo', 'EUC_JP', 'UNICODE');
convert
---------
foo
(1 row)
--- UNICODE --> TCVN
-SELECT CONVERT('foo' USING utf8_to_tcvn);
+-- UNICODE --> EUC_JP
+SELECT CONVERT('foo' USING utf_8_to_euc_jp);
convert
---------
foo
(1 row)
-SELECT CONVERT('foo', 'UNICODE', 'TCVN');
+SELECT CONVERT('foo', 'UNICODE', 'EUC_JP');
+ convert
+---------
+ foo
+(1 row)
+
+-- EUC_KR --> UNICODE
+SELECT CONVERT('foo' USING euc_kr_to_utf_8);
+ convert
+---------
+ foo
+(1 row)
+
+SELECT CONVERT('foo', 'EUC_KR', 'UNICODE');
+ convert
+---------
+ foo
+(1 row)
+
+-- UNICODE --> EUC_KR
+SELECT CONVERT('foo' USING utf_8_to_euc_kr);
+ convert
+---------
+ foo
+(1 row)
+
+SELECT CONVERT('foo', 'UNICODE', 'EUC_KR');
+ convert
+---------
+ foo
+(1 row)
+
+-- EUC_TW --> UNICODE
+SELECT CONVERT('foo' USING euc_tw_to_utf_8);
+ convert
+---------
+ foo
+(1 row)
+
+SELECT CONVERT('foo', 'EUC_TW', 'UNICODE');
+ convert
+---------
+ foo
+(1 row)
+
+-- UNICODE --> EUC_TW
+SELECT CONVERT('foo' USING utf_8_to_euc_tw);
+ convert
+---------
+ foo
+(1 row)
+
+SELECT CONVERT('foo', 'UNICODE', 'EUC_TW');
+ convert
+---------
+ foo
+(1 row)
+
+-- GB18030 --> UNICODE
+SELECT CONVERT('foo' USING gb18030_to_utf_8);
+ convert
+---------
+ foo
+(1 row)
+
+SELECT CONVERT('foo', 'GB18030', 'UNICODE');
+ convert
+---------
+ foo
+(1 row)
+
+-- UNICODE --> GB18030
+SELECT CONVERT('foo' USING utf_8_to_gb18030);
+ convert
+---------
+ foo
+(1 row)
+
+SELECT CONVERT('foo', 'UNICODE', 'GB18030');
+ convert
+---------
+ foo
+(1 row)
+
+-- GBK --> UNICODE
+SELECT CONVERT('foo' USING gbk_to_utf_8);
+ convert
+---------
+ foo
+(1 row)
+
+SELECT CONVERT('foo', 'GBK', 'UNICODE');
+ convert
+---------
+ foo
+(1 row)
+
+-- UNICODE --> GBK
+SELECT CONVERT('foo' USING utf_8_to_gbk);
+ convert
+---------
+ foo
+(1 row)
+
+SELECT CONVERT('foo', 'UNICODE', 'GBK');
convert
---------
foo
(1 row)
-- UNICODE --> LATIN2
-SELECT CONVERT('foo' USING utf8_to_iso8859_2);
+SELECT CONVERT('foo' USING utf_8_to_iso_8859_2);
convert
---------
foo
(1 row)
-- LATIN2 --> UNICODE
-SELECT CONVERT('foo' USING iso8859_2_to_utf8);
+SELECT CONVERT('foo' USING iso_8859_2_to_utf_8);
convert
---------
foo
(1 row)
-- UNICODE --> LATIN3
-SELECT CONVERT('foo' USING utf8_to_iso8859_3);
+SELECT CONVERT('foo' USING utf_8_to_iso_8859_3);
convert
---------
foo
(1 row)
-- LATIN3 --> UNICODE
-SELECT CONVERT('foo' USING iso8859_3_to_utf8);
+SELECT CONVERT('foo' USING iso_8859_3_to_utf_8);
convert
---------
foo
(1 row)
-- UNICODE --> LATIN4
-SELECT CONVERT('foo' USING utf8_to_iso8859_4);
+SELECT CONVERT('foo' USING utf_8_to_iso_8859_4);
convert
---------
foo
(1 row)
-- LATIN4 --> UNICODE
-SELECT CONVERT('foo' USING iso8859_4_to_utf8);
+SELECT CONVERT('foo' USING iso_8859_4_to_utf_8);
convert
---------
foo
(1 row)
-- UNICODE --> LATIN5
-SELECT CONVERT('foo' USING utf8_to_iso8859_9);
+SELECT CONVERT('foo' USING utf_8_to_iso_8859_9);
convert
---------
foo
(1 row)
-- LATIN5 --> UNICODE
-SELECT CONVERT('foo' USING iso8859_9_to_utf8);
+SELECT CONVERT('foo' USING iso_8859_9_to_utf_8);
convert
---------
foo
(1 row)
-- UNICODE --> LATIN6
-SELECT CONVERT('foo' USING utf8_to_iso8859_10);
+SELECT CONVERT('foo' USING utf_8_to_iso_8859_10);
convert
---------
foo
(1 row)
-- LATIN6 --> UNICODE
-SELECT CONVERT('foo' USING iso8859_10_to_utf8);
+SELECT CONVERT('foo' USING iso_8859_10_to_utf_8);
convert
---------
foo
(1 row)
-- UNICODE --> LATIN7
-SELECT CONVERT('foo' USING utf8_to_iso8859_13);
+SELECT CONVERT('foo' USING utf_8_to_iso_8859_13);
convert
---------
foo
(1 row)
-- LATIN7 --> UNICODE
-SELECT CONVERT('foo' USING iso8859_13_to_utf8);
+SELECT CONVERT('foo' USING iso_8859_13_to_utf_8);
convert
---------
foo
(1 row)
-- UNICODE --> LATIN8
-SELECT CONVERT('foo' USING utf8_to_iso8859_14);
+SELECT CONVERT('foo' USING utf_8_to_iso_8859_14);
convert
---------
foo
(1 row)
-- LATIN8 --> UNICODE
-SELECT CONVERT('foo' USING iso8859_14_to_utf8);
+SELECT CONVERT('foo' USING iso_8859_14_to_utf_8);
convert
---------
foo
(1 row)
-- UNICODE --> LATIN9
-SELECT CONVERT('foo' USING utf8_to_iso8859_15);
+SELECT CONVERT('foo' USING utf_8_to_iso_8859_15);
convert
---------
foo
(1 row)
-- LATIN9 --> UNICODE
-SELECT CONVERT('foo' USING iso8859_15_to_utf8);
+SELECT CONVERT('foo' USING iso_8859_15_to_utf_8);
convert
---------
foo
(1 row)
-- UNICODE --> LATIN10
-SELECT CONVERT('foo' USING utf8_to_iso8859_16);
+SELECT CONVERT('foo' USING utf_8_to_iso_8859_16);
convert
---------
foo
(1 row)
-- LATIN10 --> UNICODE
-SELECT CONVERT('foo' USING iso8859_16_to_utf8);
+SELECT CONVERT('foo' USING iso_8859_16_to_utf_8);
convert
---------
foo
(1 row)
-- UNICODE --> ISO-8859-5
-SELECT CONVERT('foo' USING utf8_to_iso8859_5);
+SELECT CONVERT('foo' USING utf_8_to_iso_8859_5);
convert
---------
foo
(1 row)
-- ISO-8859-5 --> UNICODE
-SELECT CONVERT('foo' USING iso8859_5_to_utf8);
+SELECT CONVERT('foo' USING iso_8859_5_to_utf_8);
convert
---------
foo
(1 row)
-- UNICODE --> ISO-8859-6
-SELECT CONVERT('foo' USING utf8_to_iso8859_6);
+SELECT CONVERT('foo' USING utf_8_to_iso_8859_6);
convert
---------
foo
(1 row)
-- ISO-8859-6 --> UNICODE
-SELECT CONVERT('foo' USING iso8859_6_to_utf8);
+SELECT CONVERT('foo' USING iso_8859_6_to_utf_8);
convert
---------
foo
(1 row)
-- UNICODE --> ISO-8859-7
-SELECT CONVERT('foo' USING utf8_to_iso8859_7);
+SELECT CONVERT('foo' USING utf_8_to_iso_8859_7);
convert
---------
foo
(1 row)
-- ISO-8859-7 --> UNICODE
-SELECT CONVERT('foo' USING iso8859_7_to_utf8);
+SELECT CONVERT('foo' USING iso_8859_7_to_utf_8);
convert
---------
foo
(1 row)
-- UNICODE --> ISO-8859-8
-SELECT CONVERT('foo' USING utf8_to_iso8859_8);
+SELECT CONVERT('foo' USING utf_8_to_iso_8859_8);
convert
---------
foo
(1 row)
-- ISO-8859-8 --> UNICODE
-SELECT CONVERT('foo' USING iso8859_8_to_utf8);
+SELECT CONVERT('foo' USING iso_8859_8_to_utf_8);
convert
---------
foo
foo
(1 row)
--- EUC_JP --> SJIS
-SELECT CONVERT('foo' USING euc_jp_to_sjis);
+-- LATIN1 --> UNICODE
+SELECT CONVERT('foo' USING iso_8859_1_to_utf_8);
convert
---------
foo
(1 row)
-SELECT CONVERT('foo', 'EUC_JP', 'SJIS');
+SELECT CONVERT('foo', 'LATIN1', 'UNICODE');
convert
---------
foo
(1 row)
--- SJIS --> EUC_JP
-SELECT CONVERT('foo' USING sjis_to_euc_jp);
+-- UNICODE --> LATIN1
+SELECT CONVERT('foo' USING utf_8_to_iso_8859_1);
convert
---------
foo
(1 row)
-SELECT CONVERT('foo', 'SJIS', 'EUC_JP');
+SELECT CONVERT('foo', 'UNICODE', 'LATIN1');
convert
---------
foo
(1 row)
--- EUC_JP --> MULE_INTERNAL
-SELECT CONVERT('foo' USING euc_jp_to_mic);
+-- JOHAB --> UNICODE
+SELECT CONVERT('foo' USING johab_to_utf_8);
convert
---------
foo
(1 row)
-SELECT CONVERT('foo', 'EUC_JP', 'MULE_INTERNAL');
+SELECT CONVERT('foo', 'JOHAB', 'UNICODE');
convert
---------
foo
(1 row)
--- SJIS --> MULE_INTERNAL
-SELECT CONVERT('foo' USING sjis_to_mic);
+-- UNICODE --> JOHAB
+SELECT CONVERT('foo' USING utf_8_to_johab);
convert
---------
foo
(1 row)
-SELECT CONVERT('foo', 'SJIS', 'MULE_INTERNAL');
+SELECT CONVERT('foo', 'UNICODE', 'JOHAB');
convert
---------
foo
(1 row)
--- MULE_INTERNAL --> EUC_JP
-SELECT CONVERT('foo' USING mic_to_euc_jp);
+-- SJIS --> UNICODE
+SELECT CONVERT('foo' USING sjis_to_utf_8);
convert
---------
foo
(1 row)
-SELECT CONVERT('foo', 'MULE_INTERNAL', 'EUC_JP');
+SELECT CONVERT('foo', 'SJIS', 'UNICODE');
convert
---------
foo
(1 row)
--- MULE_INTERNAL --> SJIS
-SELECT CONVERT('foo' USING mic_to_sjis);
+-- UNICODE --> SJIS
+SELECT CONVERT('foo' USING utf_8_to_sjis);
convert
---------
foo
(1 row)
-SELECT CONVERT('foo', 'MULE_INTERNAL', 'SJIS');
+SELECT CONVERT('foo', 'UNICODE', 'SJIS');
convert
---------
foo
(1 row)
--- EUC_TW --> BIG5
-SELECT CONVERT('foo' USING euc_tw_to_big5);
+-- TCVN --> UNICODE
+SELECT CONVERT('foo' USING tcvn_to_utf_8);
convert
---------
foo
(1 row)
-SELECT CONVERT('foo', 'EUC_TW', 'BIG5');
+SELECT CONVERT('foo', 'TCVN', 'UNICODE');
convert
---------
foo
(1 row)
--- BIG5 --> EUC_TW
-SELECT CONVERT('foo' USING big5_to_euc_tw);
+-- UNICODE --> TCVN
+SELECT CONVERT('foo' USING utf_8_to_tcvn);
convert
---------
foo
(1 row)
-SELECT CONVERT('foo', 'BIG5', 'EUC_TW');
+SELECT CONVERT('foo', 'UNICODE', 'TCVN');
convert
---------
foo
(1 row)
--- EUC_TW --> MULE_INTERNAL
-SELECT CONVERT('foo' USING euc_tw_to_mic);
+-- UHC --> UNICODE
+SELECT CONVERT('foo' USING uhc_to_utf_8);
convert
---------
foo
(1 row)
-SELECT CONVERT('foo', 'EUC_TW', 'MULE_INTERNAL');
+SELECT CONVERT('foo', 'UHC', 'UNICODE');
convert
---------
foo
(1 row)
--- BIG5 --> MULE_INTERNAL
-SELECT CONVERT('foo' USING big5_to_mic);
+-- UNICODE --> UHC
+SELECT CONVERT('foo' USING utf_8_to_uhc);
convert
---------
foo
(1 row)
-SELECT CONVERT('foo', 'BIG5', 'MULE_INTERNAL');
+SELECT CONVERT('foo', 'UNICODE', 'UHC');
convert
---------
foo
(1 row)
--- MULE_INTERNAL --> EUC_TW
-SELECT CONVERT('foo' USING mic_to_euc_tw);
+-- UNICODE --> WIN1250
+SELECT CONVERT('foo' USING utf_8_to_win1250);
convert
---------
foo
(1 row)
-SELECT CONVERT('foo', 'MULE_INTERNAL', 'EUC_TW');
+SELECT CONVERT('foo', 'UNICODE', 'WIN1250');
convert
---------
foo
(1 row)
--- MULE_INTERNAL --> BIG5
-SELECT CONVERT('foo' USING mic_to_big5);
+-- WIN1250 --> UNICODE
+SELECT CONVERT('foo' USING win1250_to_utf_8);
convert
---------
foo
(1 row)
-SELECT CONVERT('foo', 'MULE_INTERNAL', 'BIG5');
+SELECT CONVERT('foo', 'WIN1250', 'UNICODE');
+ convert
+---------
+ foo
+(1 row)
+
+-- UNICODE --> WIN1256
+SELECT CONVERT('foo' USING utf_8_to_win1256);
+ convert
+---------
+ foo
+(1 row)
+
+SELECT CONVERT('foo', 'UNICODE', 'WIN1256');
+ convert
+---------
+ foo
+(1 row)
+
+-- WIN1256 --> UNICODE
+SELECT CONVERT('foo' USING win1256_to_utf_8);
+ convert
+---------
+ foo
+(1 row)
+
+SELECT CONVERT('foo', 'WIN1256', 'UNICODE');
+ convert
+---------
+ foo
+(1 row)
+
+-- UNICODE --> WIN874
+SELECT CONVERT('foo' USING utf_8_to_win874);
+ convert
+---------
+ foo
+(1 row)
+
+SELECT CONVERT('foo', 'UNICODE', 'WIN874');
+ convert
+---------
+ foo
+(1 row)
+
+-- WIN874 --> UNICODE
+SELECT CONVERT('foo' USING win874_to_utf_8);
+ convert
+---------
+ foo
+(1 row)
+
+SELECT CONVERT('foo', 'WIN874', 'UNICODE');
convert
---------
foo
DROP CONVERSION mydef;
--
-- make sure all pre-defined conversions are fine.
--- UNICODE --> SQL_ASCII
-SELECT CONVERT('foo' USING utf8_to_ascii);
-SELECT CONVERT('foo', 'UNICODE', 'SQL_ASCII');
+-- SQL_ASCII --> MULE_INTERNAL
+SELECT CONVERT('foo' USING ascii_to_mic);
+SELECT CONVERT('foo', 'SQL_ASCII', 'MULE_INTERNAL');
+-- MULE_INTERNAL --> SQL_ASCII
+SELECT CONVERT('foo' USING mic_to_ascii);
+SELECT CONVERT('foo', 'MULE_INTERNAL', 'SQL_ASCII');
+-- KOI8R --> MULE_INTERNAL
+SELECT CONVERT('foo' USING koi8r_to_mic);
+SELECT CONVERT('foo', 'KOI8R', 'MULE_INTERNAL');
+-- MULE_INTERNAL --> KOI8R
+SELECT CONVERT('foo' USING mic_to_koi8r);
+SELECT CONVERT('foo', 'MULE_INTERNAL', 'KOI8R');
+-- ISO-8859-5 --> MULE_INTERNAL
+SELECT CONVERT('foo' USING iso_8859_5_to_mic);
+SELECT CONVERT('foo', 'ISO-8859-5', 'MULE_INTERNAL');
+-- MULE_INTERNAL --> ISO-8859-5
+SELECT CONVERT('foo' USING mic_to_iso_8859_5);
+SELECT CONVERT('foo', 'MULE_INTERNAL', 'ISO-8859-5');
+-- WIN1251 --> MULE_INTERNAL
+SELECT CONVERT('foo' USING win1251_to_mic);
+SELECT CONVERT('foo', 'WIN1251', 'MULE_INTERNAL');
+-- MULE_INTERNAL --> WIN1251
+SELECT CONVERT('foo' USING mic_to_win1251);
+SELECT CONVERT('foo', 'MULE_INTERNAL', 'WIN1251');
+-- ALT --> MULE_INTERNAL
+SELECT CONVERT('foo' USING win866_to_mic);
+SELECT CONVERT('foo', 'ALT', 'MULE_INTERNAL');
+-- MULE_INTERNAL --> ALT
+SELECT CONVERT('foo' USING mic_to_win866);
+SELECT CONVERT('foo', 'MULE_INTERNAL', 'ALT');
+-- KOI8R --> WIN1251
+SELECT CONVERT('foo' USING koi8r_to_win1251);
+SELECT CONVERT('foo', 'KOI8R', 'WIN1251');
+-- WIN1251 --> KOI8R
+SELECT CONVERT('foo' USING win1251_to_koi8r);
+SELECT CONVERT('foo', 'WIN1251', 'KOI8R');
+-- KOI8R --> ALT
+SELECT CONVERT('foo' USING koi8r_to_win866);
+SELECT CONVERT('foo', 'KOI8R', 'ALT');
+-- ALT --> KOI8R
+SELECT CONVERT('foo' USING win866_to_koi8r);
+SELECT CONVERT('foo', 'ALT', 'KOI8R');
+-- ALT --> WIN1251
+SELECT CONVERT('foo' USING win866_to_win1251);
+SELECT CONVERT('foo', 'ALT', 'WIN1251');
+-- WIN1251 --> ALT
+SELECT CONVERT('foo' USING win1251_to_win866);
+SELECT CONVERT('foo', 'WIN1251', 'ALT');
+-- ISO-8859-5 --> KOI8R
+SELECT CONVERT('foo' USING iso_8859_5_to_koi8r);
+SELECT CONVERT('foo', 'ISO-8859-5', 'KOI8R');
+-- KOI8R --> ISO-8859-5
+SELECT CONVERT('foo' USING koi8r_to_iso_8859_5);
+SELECT CONVERT('foo', 'KOI8R', 'ISO-8859-5');
+-- ISO-8859-5 --> WIN1251
+SELECT CONVERT('foo' USING iso_8859_5_to_win1251);
+SELECT CONVERT('foo', 'ISO-8859-5', 'WIN1251');
+-- WIN1251 --> ISO-8859-5
+SELECT CONVERT('foo' USING win1251_to_iso_8859_5);
+SELECT CONVERT('foo', 'WIN1251', 'ISO-8859-5');
+-- ISO-8859-5 --> ALT
+SELECT CONVERT('foo' USING iso_8859_5_to_win866);
+SELECT CONVERT('foo', 'ISO-8859-5', 'ALT');
+-- ALT --> ISO-8859-5
+SELECT CONVERT('foo' USING win866_to_iso_8859_5);
+SELECT CONVERT('foo', 'ALT', 'ISO-8859-5');
+-- EUC_CN --> MULE_INTERNAL
+SELECT CONVERT('foo' USING euc_cn_to_mic);
+SELECT CONVERT('foo', 'EUC_CN', 'MULE_INTERNAL');
+-- MULE_INTERNAL --> EUC_CN
+SELECT CONVERT('foo' USING mic_to_euc_cn);
+SELECT CONVERT('foo', 'MULE_INTERNAL', 'EUC_CN');
+-- EUC_JP --> SJIS
+SELECT CONVERT('foo' USING euc_jp_to_sjis);
+SELECT CONVERT('foo', 'EUC_JP', 'SJIS');
+-- SJIS --> EUC_JP
+SELECT CONVERT('foo' USING sjis_to_euc_jp);
+SELECT CONVERT('foo', 'SJIS', 'EUC_JP');
+-- EUC_JP --> MULE_INTERNAL
+SELECT CONVERT('foo' USING euc_jp_to_mic);
+SELECT CONVERT('foo', 'EUC_JP', 'MULE_INTERNAL');
+-- SJIS --> MULE_INTERNAL
+SELECT CONVERT('foo' USING sjis_to_mic);
+SELECT CONVERT('foo', 'SJIS', 'MULE_INTERNAL');
+-- MULE_INTERNAL --> EUC_JP
+SELECT CONVERT('foo' USING mic_to_euc_jp);
+SELECT CONVERT('foo', 'MULE_INTERNAL', 'EUC_JP');
+-- MULE_INTERNAL --> SJIS
+SELECT CONVERT('foo' USING mic_to_sjis);
+SELECT CONVERT('foo', 'MULE_INTERNAL', 'SJIS');
+-- EUC_KR --> MULE_INTERNAL
+SELECT CONVERT('foo' USING euc_kr_to_mic);
+SELECT CONVERT('foo', 'EUC_KR', 'MULE_INTERNAL');
+-- MULE_INTERNAL --> EUC_KR
+SELECT CONVERT('foo' USING mic_to_euc_kr);
+SELECT CONVERT('foo', 'MULE_INTERNAL', 'EUC_KR');
+-- EUC_TW --> BIG5
+SELECT CONVERT('foo' USING euc_tw_to_big5);
+SELECT CONVERT('foo', 'EUC_TW', 'BIG5');
+-- BIG5 --> EUC_TW
+SELECT CONVERT('foo' USING big5_to_euc_tw);
+SELECT CONVERT('foo', 'BIG5', 'EUC_TW');
+-- EUC_TW --> MULE_INTERNAL
+SELECT CONVERT('foo' USING euc_tw_to_mic);
+SELECT CONVERT('foo', 'EUC_TW', 'MULE_INTERNAL');
+-- BIG5 --> MULE_INTERNAL
+SELECT CONVERT('foo' USING big5_to_mic);
+SELECT CONVERT('foo', 'BIG5', 'MULE_INTERNAL');
+-- MULE_INTERNAL --> EUC_TW
+SELECT CONVERT('foo' USING mic_to_euc_tw);
+SELECT CONVERT('foo', 'MULE_INTERNAL', 'EUC_TW');
+-- MULE_INTERNAL --> BIG5
+SELECT CONVERT('foo' USING mic_to_big5);
+SELECT CONVERT('foo', 'MULE_INTERNAL', 'BIG5');
+-- LATIN2 --> MULE_INTERNAL
+SELECT CONVERT('foo' USING iso_8859_2_to_mic);
+SELECT CONVERT('foo', 'LATIN2', 'MULE_INTERNAL');
+-- MULE_INTERNAL --> LATIN2
+SELECT CONVERT('foo' USING mic_to_iso_8859_2);
+SELECT CONVERT('foo', 'MULE_INTERNAL', 'LATIN2');
+-- WIN1250 --> MULE_INTERNAL
+SELECT CONVERT('foo' USING win1250_to_mic);
+SELECT CONVERT('foo', 'WIN1250', 'MULE_INTERNAL');
+-- MULE_INTERNAL --> WIN1250
+SELECT CONVERT('foo' USING mic_to_win1250);
+SELECT CONVERT('foo', 'MULE_INTERNAL', 'WIN1250');
+-- LATIN2 --> WIN1250
+SELECT CONVERT('foo' USING iso_8859_2_to_win1250);
+SELECT CONVERT('foo', 'LATIN2', 'WIN1250');
+-- WIN1250 --> LATIN2
+SELECT CONVERT('foo' USING win1250_to_iso_8859_2);
+SELECT CONVERT('foo', 'WIN1250', 'LATIN2');
+-- LATIN1 --> MULE_INTERNAL
+SELECT CONVERT('foo' USING iso_8859_1_to_mic);
+SELECT CONVERT('foo', 'LATIN1', 'MULE_INTERNAL');
+-- MULE_INTERNAL --> LATIN1
+SELECT CONVERT('foo' USING mic_to_iso_8859_1);
+SELECT CONVERT('foo', 'MULE_INTERNAL', 'LATIN1');
+-- LATIN3 --> MULE_INTERNAL
+SELECT CONVERT('foo' USING iso_8859_3_to_mic);
+SELECT CONVERT('foo', 'LATIN3', 'MULE_INTERNAL');
+-- MULE_INTERNAL --> LATIN3
+SELECT CONVERT('foo' USING mic_to_iso_8859_3);
+SELECT CONVERT('foo', 'MULE_INTERNAL', 'LATIN3');
+-- LATIN4 --> MULE_INTERNAL
+SELECT CONVERT('foo' USING iso_8859_4_to_mic);
+SELECT CONVERT('foo', 'LATIN4', 'MULE_INTERNAL');
+-- MULE_INTERNAL --> LATIN4
+SELECT CONVERT('foo' USING mic_to_iso_8859_4);
+SELECT CONVERT('foo', 'MULE_INTERNAL', 'LATIN4');
-- SQL_ASCII --> UNICODE
-SELECT CONVERT('foo' USING ascii_to_utf8);
+SELECT CONVERT('foo' USING ascii_to_utf_8);
SELECT CONVERT('foo', 'SQL_ASCII', 'UNICODE');
--- UNICODE --> LATIN1
-SELECT CONVERT('foo' USING utf8_to_iso8859_1);
-SELECT CONVERT('foo', 'UNICODE', 'LATIN1');
--- LATIN1 --> UNICODE
-SELECT CONVERT('foo' USING iso8859_1_to_utf8);
-SELECT CONVERT('foo', 'LATIN1', 'UNICODE');
+-- UNICODE --> SQL_ASCII
+SELECT CONVERT('foo' USING utf_8_to_ascii);
+SELECT CONVERT('foo', 'UNICODE', 'SQL_ASCII');
+-- BIG5 --> UNICODE
+SELECT CONVERT('foo' USING big5_to_utf_8);
+SELECT CONVERT('foo', 'BIG5', 'UNICODE');
+-- UNICODE --> BIG5
+SELECT CONVERT('foo' USING utf_8_to_big5);
+SELECT CONVERT('foo', 'UNICODE', 'BIG5');
+-- UNICODE --> KOI8R
+SELECT CONVERT('foo' USING utf_8_to_koi8r);
+SELECT CONVERT('foo', 'UNICODE', 'KOI8R');
+-- KOI8R --> UNICODE
+SELECT CONVERT('foo' USING koi8r_to_utf_8);
+SELECT CONVERT('foo', 'KOI8R', 'UNICODE');
+-- UNICODE --> WIN1251
+SELECT CONVERT('foo' USING utf_8_to_win1251);
+SELECT CONVERT('foo', 'UNICODE', 'WIN1251');
+-- WIN1251 --> UNICODE
+SELECT CONVERT('foo' USING win1251_to_utf_8);
+SELECT CONVERT('foo', 'WIN1251', 'UNICODE');
+-- UNICODE --> ALT
+SELECT CONVERT('foo' USING utf_8_to_win866);
+SELECT CONVERT('foo', 'UNICODE', 'ALT');
+-- ALT --> UNICODE
+SELECT CONVERT('foo' USING win866_to_utf_8);
+SELECT CONVERT('foo', 'ALT', 'UNICODE');
+-- EUC_CN --> UNICODE
+SELECT CONVERT('foo' USING euc_cn_to_utf_8);
+SELECT CONVERT('foo', 'EUC_CN', 'UNICODE');
+-- UNICODE --> EUC_CN
+SELECT CONVERT('foo' USING utf_8_to_euc_cn);
+SELECT CONVERT('foo', 'UNICODE', 'EUC_CN');
-- EUC_JP --> UNICODE
-SELECT CONVERT('foo' USING euc_jp_to_utf8);
+SELECT CONVERT('foo' USING euc_jp_to_utf_8);
SELECT CONVERT('foo', 'EUC_JP', 'UNICODE');
-- UNICODE --> EUC_JP
-SELECT CONVERT('foo' USING utf8_to_euc_jp);
+SELECT CONVERT('foo' USING utf_8_to_euc_jp);
SELECT CONVERT('foo', 'UNICODE', 'EUC_JP');
-- EUC_KR --> UNICODE
-SELECT CONVERT('foo' USING euc_kr_to_utf8);
+SELECT CONVERT('foo' USING euc_kr_to_utf_8);
SELECT CONVERT('foo', 'EUC_KR', 'UNICODE');
-- UNICODE --> EUC_KR
-SELECT CONVERT('foo' USING utf8_to_euc_kr);
+SELECT CONVERT('foo' USING utf_8_to_euc_kr);
SELECT CONVERT('foo', 'UNICODE', 'EUC_KR');
--- EUC_CN --> UNICODE
-SELECT CONVERT('foo' USING euc_cn_to_utf8);
-SELECT CONVERT('foo', 'EUC_CN', 'UNICODE');
--- UNICODE --> EUC_CN
-SELECT CONVERT('foo' USING utf8_to_euc_cn);
-SELECT CONVERT('foo', 'UNICODE', 'EUC_CN');
-- EUC_TW --> UNICODE
-SELECT CONVERT('foo' USING euc_tw_to_utf8);
+SELECT CONVERT('foo' USING euc_tw_to_utf_8);
SELECT CONVERT('foo', 'EUC_TW', 'UNICODE');
-- UNICODE --> EUC_TW
-SELECT CONVERT('foo' USING utf8_to_euc_tw);
+SELECT CONVERT('foo' USING utf_8_to_euc_tw);
SELECT CONVERT('foo', 'UNICODE', 'EUC_TW');
--- SJIS --> UNICODE
-SELECT CONVERT('foo' USING sjis_to_utf8);
-SELECT CONVERT('foo', 'SJIS', 'UNICODE');
--- UNICODE --> SJIS
-SELECT CONVERT('foo' USING utf8_to_sjis);
-SELECT CONVERT('foo', 'UNICODE', 'SJIS');
--- BIG5 --> UNICODE
-SELECT CONVERT('foo' USING big5_to_utf8);
-SELECT CONVERT('foo', 'BIG5', 'UNICODE');
--- UNICODE --> BIG5
-SELECT CONVERT('foo' USING utf8_to_big5);
-SELECT CONVERT('foo', 'UNICODE', 'BIG5');
--- GBK --> UNICODE
-SELECT CONVERT('foo' USING gbk_to_utf8);
-SELECT CONVERT('foo', 'GBK', 'UNICODE');
--- UNICODE --> GBK
-SELECT CONVERT('foo' USING utf8_to_gbk);
-SELECT CONVERT('foo', 'UNICODE', 'GBK');
-- GB18030 --> UNICODE
-SELECT CONVERT('foo' USING gb18030_to_utf8);
+SELECT CONVERT('foo' USING gb18030_to_utf_8);
SELECT CONVERT('foo', 'GB18030', 'UNICODE');
-- UNICODE --> GB18030
-SELECT CONVERT('foo' USING utf8_to_gb18030);
+SELECT CONVERT('foo' USING utf_8_to_gb18030);
SELECT CONVERT('foo', 'UNICODE', 'GB18030');
--- UHC --> UNICODE
-SELECT CONVERT('foo' USING uhc_to_utf8);
-SELECT CONVERT('foo', 'UHC', 'UNICODE');
--- UNICODE --> UHC
-SELECT CONVERT('foo' USING utf8_to_uhc);
-SELECT CONVERT('foo', 'UNICODE', 'UHC');
--- JOHAB --> UNICODE
-SELECT CONVERT('foo' USING johab_to_utf8);
-SELECT CONVERT('foo', 'JOHAB', 'UNICODE');
--- UNICODE --> JOHAB
-SELECT CONVERT('foo' USING utf8_to_johab);
-SELECT CONVERT('foo', 'UNICODE', 'JOHAB');
--- TCVN --> UNICODE
-SELECT CONVERT('foo' USING tcvn_to_utf8);
-SELECT CONVERT('foo', 'TCVN', 'UNICODE');
--- UNICODE --> TCVN
-SELECT CONVERT('foo' USING utf8_to_tcvn);
-SELECT CONVERT('foo', 'UNICODE', 'TCVN');
+-- GBK --> UNICODE
+SELECT CONVERT('foo' USING gbk_to_utf_8);
+SELECT CONVERT('foo', 'GBK', 'UNICODE');
+-- UNICODE --> GBK
+SELECT CONVERT('foo' USING utf_8_to_gbk);
+SELECT CONVERT('foo', 'UNICODE', 'GBK');
-- UNICODE --> LATIN2
-SELECT CONVERT('foo' USING utf8_to_iso8859_2);
+SELECT CONVERT('foo' USING utf_8_to_iso_8859_2);
SELECT CONVERT('foo', 'UNICODE', 'LATIN2');
-- LATIN2 --> UNICODE
-SELECT CONVERT('foo' USING iso8859_2_to_utf8);
+SELECT CONVERT('foo' USING iso_8859_2_to_utf_8);
SELECT CONVERT('foo', 'LATIN2', 'UNICODE');
-- UNICODE --> LATIN3
-SELECT CONVERT('foo' USING utf8_to_iso8859_3);
+SELECT CONVERT('foo' USING utf_8_to_iso_8859_3);
SELECT CONVERT('foo', 'UNICODE', 'LATIN3');
-- LATIN3 --> UNICODE
-SELECT CONVERT('foo' USING iso8859_3_to_utf8);
+SELECT CONVERT('foo' USING iso_8859_3_to_utf_8);
SELECT CONVERT('foo', 'LATIN3', 'UNICODE');
-- UNICODE --> LATIN4
-SELECT CONVERT('foo' USING utf8_to_iso8859_4);
+SELECT CONVERT('foo' USING utf_8_to_iso_8859_4);
SELECT CONVERT('foo', 'UNICODE', 'LATIN4');
-- LATIN4 --> UNICODE
-SELECT CONVERT('foo' USING iso8859_4_to_utf8);
+SELECT CONVERT('foo' USING iso_8859_4_to_utf_8);
SELECT CONVERT('foo', 'LATIN4', 'UNICODE');
-- UNICODE --> LATIN5
-SELECT CONVERT('foo' USING utf8_to_iso8859_9);
+SELECT CONVERT('foo' USING utf_8_to_iso_8859_9);
SELECT CONVERT('foo', 'UNICODE', 'LATIN5');
-- LATIN5 --> UNICODE
-SELECT CONVERT('foo' USING iso8859_9_to_utf8);
+SELECT CONVERT('foo' USING iso_8859_9_to_utf_8);
SELECT CONVERT('foo', 'LATIN5', 'UNICODE');
-- UNICODE --> LATIN6
-SELECT CONVERT('foo' USING utf8_to_iso8859_10);
+SELECT CONVERT('foo' USING utf_8_to_iso_8859_10);
SELECT CONVERT('foo', 'UNICODE', 'LATIN6');
-- LATIN6 --> UNICODE
-SELECT CONVERT('foo' USING iso8859_10_to_utf8);
+SELECT CONVERT('foo' USING iso_8859_10_to_utf_8);
SELECT CONVERT('foo', 'LATIN6', 'UNICODE');
-- UNICODE --> LATIN7
-SELECT CONVERT('foo' USING utf8_to_iso8859_13);
+SELECT CONVERT('foo' USING utf_8_to_iso_8859_13);
SELECT CONVERT('foo', 'UNICODE', 'LATIN7');
-- LATIN7 --> UNICODE
-SELECT CONVERT('foo' USING iso8859_13_to_utf8);
+SELECT CONVERT('foo' USING iso_8859_13_to_utf_8);
SELECT CONVERT('foo', 'LATIN7', 'UNICODE');
-- UNICODE --> LATIN8
-SELECT CONVERT('foo' USING utf8_to_iso8859_14);
+SELECT CONVERT('foo' USING utf_8_to_iso_8859_14);
SELECT CONVERT('foo', 'UNICODE', 'LATIN8');
-- LATIN8 --> UNICODE
-SELECT CONVERT('foo' USING iso8859_14_to_utf8);
+SELECT CONVERT('foo' USING iso_8859_14_to_utf_8);
SELECT CONVERT('foo', 'LATIN8', 'UNICODE');
-- UNICODE --> LATIN9
-SELECT CONVERT('foo' USING utf8_to_iso8859_15);
+SELECT CONVERT('foo' USING utf_8_to_iso_8859_15);
SELECT CONVERT('foo', 'UNICODE', 'LATIN9');
-- LATIN9 --> UNICODE
-SELECT CONVERT('foo' USING iso8859_15_to_utf8);
+SELECT CONVERT('foo' USING iso_8859_15_to_utf_8);
SELECT CONVERT('foo', 'LATIN9', 'UNICODE');
-- UNICODE --> LATIN10
-SELECT CONVERT('foo' USING utf8_to_iso8859_16);
+SELECT CONVERT('foo' USING utf_8_to_iso_8859_16);
SELECT CONVERT('foo', 'UNICODE', 'LATIN10');
-- LATIN10 --> UNICODE
-SELECT CONVERT('foo' USING iso8859_16_to_utf8);
+SELECT CONVERT('foo' USING iso_8859_16_to_utf_8);
SELECT CONVERT('foo', 'LATIN10', 'UNICODE');
-- UNICODE --> ISO-8859-5
-SELECT CONVERT('foo' USING utf8_to_iso8859_5);
+SELECT CONVERT('foo' USING utf_8_to_iso_8859_5);
SELECT CONVERT('foo', 'UNICODE', 'ISO-8859-5');
-- ISO-8859-5 --> UNICODE
-SELECT CONVERT('foo' USING iso8859_5_to_utf8);
+SELECT CONVERT('foo' USING iso_8859_5_to_utf_8);
SELECT CONVERT('foo', 'ISO-8859-5', 'UNICODE');
-- UNICODE --> ISO-8859-6
-SELECT CONVERT('foo' USING utf8_to_iso8859_6);
+SELECT CONVERT('foo' USING utf_8_to_iso_8859_6);
SELECT CONVERT('foo', 'UNICODE', 'ISO-8859-6');
-- ISO-8859-6 --> UNICODE
-SELECT CONVERT('foo' USING iso8859_6_to_utf8);
+SELECT CONVERT('foo' USING iso_8859_6_to_utf_8);
SELECT CONVERT('foo', 'ISO-8859-6', 'UNICODE');
-- UNICODE --> ISO-8859-7
-SELECT CONVERT('foo' USING utf8_to_iso8859_7);
+SELECT CONVERT('foo' USING utf_8_to_iso_8859_7);
SELECT CONVERT('foo', 'UNICODE', 'ISO-8859-7');
-- ISO-8859-7 --> UNICODE
-SELECT CONVERT('foo' USING iso8859_7_to_utf8);
+SELECT CONVERT('foo' USING iso_8859_7_to_utf_8);
SELECT CONVERT('foo', 'ISO-8859-7', 'UNICODE');
-- UNICODE --> ISO-8859-8
-SELECT CONVERT('foo' USING utf8_to_iso8859_8);
+SELECT CONVERT('foo' USING utf_8_to_iso_8859_8);
SELECT CONVERT('foo', 'UNICODE', 'ISO-8859-8');
-- ISO-8859-8 --> UNICODE
-SELECT CONVERT('foo' USING iso8859_8_to_utf8);
+SELECT CONVERT('foo' USING iso_8859_8_to_utf_8);
SELECT CONVERT('foo', 'ISO-8859-8', 'UNICODE');
--- EUC_JP --> SJIS
-SELECT CONVERT('foo' USING euc_jp_to_sjis);
-SELECT CONVERT('foo', 'EUC_JP', 'SJIS');
--- SJIS --> EUC_JP
-SELECT CONVERT('foo' USING sjis_to_euc_jp);
-SELECT CONVERT('foo', 'SJIS', 'EUC_JP');
--- EUC_JP --> MULE_INTERNAL
-SELECT CONVERT('foo' USING euc_jp_to_mic);
-SELECT CONVERT('foo', 'EUC_JP', 'MULE_INTERNAL');
--- SJIS --> MULE_INTERNAL
-SELECT CONVERT('foo' USING sjis_to_mic);
-SELECT CONVERT('foo', 'SJIS', 'MULE_INTERNAL');
--- MULE_INTERNAL --> EUC_JP
-SELECT CONVERT('foo' USING mic_to_euc_jp);
-SELECT CONVERT('foo', 'MULE_INTERNAL', 'EUC_JP');
--- MULE_INTERNAL --> SJIS
-SELECT CONVERT('foo' USING mic_to_sjis);
-SELECT CONVERT('foo', 'MULE_INTERNAL', 'SJIS');
--- EUC_TW --> BIG5
-SELECT CONVERT('foo' USING euc_tw_to_big5);
-SELECT CONVERT('foo', 'EUC_TW', 'BIG5');
--- BIG5 --> EUC_TW
-SELECT CONVERT('foo' USING big5_to_euc_tw);
-SELECT CONVERT('foo', 'BIG5', 'EUC_TW');
--- EUC_TW --> MULE_INTERNAL
-SELECT CONVERT('foo' USING euc_tw_to_mic);
-SELECT CONVERT('foo', 'EUC_TW', 'MULE_INTERNAL');
--- BIG5 --> MULE_INTERNAL
-SELECT CONVERT('foo' USING big5_to_mic);
-SELECT CONVERT('foo', 'BIG5', 'MULE_INTERNAL');
--- MULE_INTERNAL --> EUC_TW
-SELECT CONVERT('foo' USING mic_to_euc_tw);
-SELECT CONVERT('foo', 'MULE_INTERNAL', 'EUC_TW');
--- MULE_INTERNAL --> BIG5
-SELECT CONVERT('foo' USING mic_to_big5);
-SELECT CONVERT('foo', 'MULE_INTERNAL', 'BIG5');
+-- LATIN1 --> UNICODE
+SELECT CONVERT('foo' USING iso_8859_1_to_utf_8);
+SELECT CONVERT('foo', 'LATIN1', 'UNICODE');
+-- UNICODE --> LATIN1
+SELECT CONVERT('foo' USING utf_8_to_iso_8859_1);
+SELECT CONVERT('foo', 'UNICODE', 'LATIN1');
+-- JOHAB --> UNICODE
+SELECT CONVERT('foo' USING johab_to_utf_8);
+SELECT CONVERT('foo', 'JOHAB', 'UNICODE');
+-- UNICODE --> JOHAB
+SELECT CONVERT('foo' USING utf_8_to_johab);
+SELECT CONVERT('foo', 'UNICODE', 'JOHAB');
+-- SJIS --> UNICODE
+SELECT CONVERT('foo' USING sjis_to_utf_8);
+SELECT CONVERT('foo', 'SJIS', 'UNICODE');
+-- UNICODE --> SJIS
+SELECT CONVERT('foo' USING utf_8_to_sjis);
+SELECT CONVERT('foo', 'UNICODE', 'SJIS');
+-- TCVN --> UNICODE
+SELECT CONVERT('foo' USING tcvn_to_utf_8);
+SELECT CONVERT('foo', 'TCVN', 'UNICODE');
+-- UNICODE --> TCVN
+SELECT CONVERT('foo' USING utf_8_to_tcvn);
+SELECT CONVERT('foo', 'UNICODE', 'TCVN');
+-- UHC --> UNICODE
+SELECT CONVERT('foo' USING uhc_to_utf_8);
+SELECT CONVERT('foo', 'UHC', 'UNICODE');
+-- UNICODE --> UHC
+SELECT CONVERT('foo' USING utf_8_to_uhc);
+SELECT CONVERT('foo', 'UNICODE', 'UHC');
+-- UNICODE --> WIN1250
+SELECT CONVERT('foo' USING utf_8_to_win1250);
+SELECT CONVERT('foo', 'UNICODE', 'WIN1250');
+-- WIN1250 --> UNICODE
+SELECT CONVERT('foo' USING win1250_to_utf_8);
+SELECT CONVERT('foo', 'WIN1250', 'UNICODE');
+-- UNICODE --> WIN1256
+SELECT CONVERT('foo' USING utf_8_to_win1256);
+SELECT CONVERT('foo', 'UNICODE', 'WIN1256');
+-- WIN1256 --> UNICODE
+SELECT CONVERT('foo' USING win1256_to_utf_8);
+SELECT CONVERT('foo', 'WIN1256', 'UNICODE');
+-- UNICODE --> WIN874
+SELECT CONVERT('foo' USING utf_8_to_win874);
+SELECT CONVERT('foo', 'UNICODE', 'WIN874');
+-- WIN874 --> UNICODE
+SELECT CONVERT('foo' USING win874_to_utf_8);
+SELECT CONVERT('foo', 'WIN874', 'UNICODE');
--
-- return to the super user
--