diff --git a/contrib/unaccent/unaccent.c b/contrib/unaccent/unaccent.c old mode 100644 new mode 100755 index a337df6..eb7e2a3 --- a/contrib/unaccent/unaccent.c +++ b/contrib/unaccent/unaccent.c @@ -105,15 +105,15 @@ initTrie(char *filename) while ((line = tsearch_readline(&trst)) != NULL) { /* - * The format of each line must be "src trg" where src and trg + * The format of each line must be "src [trg]" where src and trg * are sequences of one or more non-whitespace characters, * separated by whitespace. Whitespace at start or end of - * line is ignored. + * line is ignored. If trg is empty, a zero-length string is used. */ int state; char *ptr; char *src = NULL; - char *trg = NULL; + char *trg = ""; int ptrlen; int srclen = 0; int trglen = 0; @@ -160,6 +160,10 @@ initTrie(char *filename) } } + /* It's OK to have a valid src and empty trg. */ + if (state > 0 && trglen == 0) + state = 5; + if (state >= 3) rootTrie = placeChar(rootTrie, (unsigned char *) src, srclen,