--- postgresql-7.2.1/src/interfaces/odbc/multibyte.c.org Wed Jun 5 18:28:30 2002 +++ postgresql-7.2.1/src/interfaces/odbc/multibyte.c Wed Jun 5 19:48:01 2002 @@ -48,6 +48,28 @@ mb_st = 0; } break; + /* Chinese GB18030 support + * By Bill Huang , + * */ + case GB18030: + { + if (mb_st < 2 && s[i] > 0x81) + mb_st = 2; + else if (mb_st == 2) + if(s[i] >= 0x30 && s[i] <= 0x39) + mb_st = 3; + else + mb_st = 1; + else if (mb_st == 3) + if(s[i] >= 0x30 && s[i] <= 0x39) + mb_st = 1; + else + mb_st = 3; + else + mb_st = 0; + } + break; + default: mb_st = 0; } @@ -87,6 +109,16 @@ { multibyte_client_encoding = BIG5; return ("BIG5"); + }/* Chinese GB18030 support. + * Added by Bill Huang , + */ + if (strstr(str, "%27GB18030%27") || + strstr(str, "%27gb18030%27") || + strstr(str, "'GB18030'") || + strstr(str, "'gb18030'") ) + { + multibyte_client_encoding = GB18030; + return ("GB18030"); } return ("OTHER"); } @@ -127,6 +159,25 @@ else multibyte_status = 0; } + break; + /*Chinese GB18030 support.Added by Bill Huang */ + case GB18030: + { + if (multibyte_status < 2 && s > 0x80) + multibyte_status = 2; + else if (multibyte_status = 2) + if (s >= 0x30 && s <= 0x39) + multibyte_status = 3; + else + multibyte_status = 1; + else if (multibyte_status = 3) + if (s >= 0x30 && s <= 0x39) + multibyte_status = 1; + else + multibyte_status = 3; + else + multibyte_status = 0; + } break; default: multibyte_status = 0;