Index: src/backend/utils/adt/like.c =================================================================== RCS file: /projects/cvsroot/pgsql/src/backend/utils/adt/like.c,v retrieving revision 1.62 diff -u -r1.62 like.c --- src/backend/utils/adt/like.c 15 Oct 2005 02:49:28 -0000 1.62 +++ src/backend/utils/adt/like.c 26 Nov 2005 11:30:07 -0000 @@ -85,25 +85,42 @@ */ if ((unsigned char) *p1 < CHARMAX && (unsigned char) *p2 < CHARMAX) return (tolower((unsigned char) *p1) == tolower((unsigned char) *p2)); + + /* + * if none of them is ASCII + */ + else if ((unsigned char) *p1 > CHARMAX && (unsigned char) *p2 > CHARMAX) + { + l = pg_mblen(p1); + (void) pg_mb2wchar_with_len(p1, c1, l); + c1[0] = tolower(c1[0]); + l = pg_mblen(p2); + (void) pg_mb2wchar_with_len(p2, c2, l); + c2[0] = tolower(c2[0]); + return (c1[0] == c2[0]); + } /* - * if one of them is an ASCII while the other is not, then they must be - * different characters + * if just the first of them is ASCII */ - else if ((unsigned char) *p1 < CHARMAX || (unsigned char) *p2 < CHARMAX) - return (0); + else if ((unsigned char) *p1 < CHARMAX) + { + l = pg_mblen(p2); + (void) pg_mb2wchar_with_len(p2, c2, l); + c2[0] = tolower(c2[0]); + return (tolower((unsigned char) *p1) == c2[0]); + } /* - * ok, p1 and p2 are both > CHARMAX, then they must be multibyte - * characters + * if just the second of them is ASCII */ - l = pg_mblen(p1); - (void) pg_mb2wchar_with_len(p1, c1, l); - c1[0] = tolower(c1[0]); - l = pg_mblen(p2); - (void) pg_mb2wchar_with_len(p2, c2, l); - c2[0] = tolower(c2[0]); - return (c1[0] == c2[0]); + else /* if ((unsigned char) *p2 < CHARMAX) */ + { + l = pg_mblen(p1); + (void) pg_mb2wchar_with_len(p1, c1, l); + c1[0] = tolower(c1[0]); + return (c1[0] == tolower((unsigned char) *p2)); + } } #define CHAREQ(p1, p2) wchareq(p1, p2)