From f0a21cfc83c9f07541e21e71e7e5d48b92651af7 Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Sat, 12 May 2012 15:27:04 +0200 Subject: [PATCH] Fixed issue #1172: character set problems Signed-off-by: Sven Strickroth --- ext/hunspell/affixmgr.cxx | 2 +- ext/hunspell/hashmgr.cxx | 4 ++-- ext/hunspell/hunspell.cxx | 36 ++++++++++++++++++------------------ 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/ext/hunspell/affixmgr.cxx b/ext/hunspell/affixmgr.cxx index c09786376..079264275 100644 --- a/ext/hunspell/affixmgr.cxx +++ b/ext/hunspell/affixmgr.cxx @@ -268,7 +268,7 @@ int AffixMgr::parse_file(const char * affpath) /* remove byte order mark */ if (firstline) { firstline = 0; - if (strncmp(line,"",3) == 0) { + if (strncmp(line,"",3) == 0) { memmove(line, line+3, strlen(line+3)+1); HUNSPELL_WARNING(stderr, "warning: affix file begins with byte order mark: possible incompatibility with old Hunspell versions\n"); } diff --git a/ext/hunspell/hashmgr.cxx b/ext/hunspell/hashmgr.cxx index 6ba2f02e7..57be70b99 100644 --- a/ext/hunspell/hashmgr.cxx +++ b/ext/hunspell/hashmgr.cxx @@ -260,7 +260,7 @@ int HashMgr::load_tables(const char * tpath) mychomp(ts); /* remove byte order mark */ - if (strncmp(ts,"",3) == 0) { + if (strncmp(ts,"?",3) == 0) { memmove(ts, ts+3, strlen(ts+3)+1); HUNSPELL_WARNING(stderr, "warning: dic file begins with byte order mark: possible incompatibility with old Hunspell versions\n"); } @@ -476,7 +476,7 @@ int HashMgr::load_config(const char * affpath) /* remove byte order mark */ if (firstline) { firstline = 0; - if (strncmp(line,"",3) == 0) memmove(line, line+3, strlen(line+3)+1); + if (strncmp(line,"",3) == 0) memmove(line, line+3, strlen(line+3)+1); } /* parse in the try string */ diff --git a/ext/hunspell/hunspell.cxx b/ext/hunspell/hunspell.cxx index 8d8f47400..9aab3480e 100644 --- a/ext/hunspell/hunspell.cxx +++ b/ext/hunspell/hunspell.cxx @@ -1,4 +1,4 @@ -#include "license.hunspell" +#include "license.hunspell" #include "license.myspell" #ifndef MOZILLA_CLIENT @@ -306,18 +306,18 @@ char * Hunspell::sharps_u8_l1(char * dest, char * source) { *p = *source; for (p++, source++; *(source - 1); p++, source++) { *p = *source; - if (*source == 'Ÿ') *--p = 'ß'; + if (*source == '?') *--p = '?'; } return dest; } -// recursive search for right ss-ß permutations +// recursive search for right ss-?permutations hentry * Hunspell::spellsharps(char * base, char * pos, int n, int repnum, char * tmp, int * info, char **root) { pos = strstr(pos, "ss"); if (pos && (n < MAXSHARPS)) { - *pos = 'Ã'; - *(pos + 1) = 'Ÿ'; + *pos = '?'; + *(pos + 1) = '?'; hentry * h = spellsharps(base, pos + 2, n + 1, repnum + 1, tmp, info, root); if (h) return h; *pos = 's'; @@ -391,7 +391,7 @@ int Hunspell::spell(const char * word, int * info, char ** root) // LANG_hu section: number(s) + (percent or degree) with suffixes if (langnum == LANG_hu) { - if ((nstate == NNUM) && ((cw[i] == '%') || (cw[i] == '°')) + if ((nstate == NNUM) && ((cw[i] == '%') || (cw[i] == '?')) && checkword(cw + i, info, root)) return 1; } // END of LANG_hu section @@ -447,10 +447,10 @@ int Hunspell::spell(const char * word, int * info, char ** root) memcpy(wspace,cw,(wl+1)); rv = checkword(wspace, info, root); if (!rv || (is_keepcase(rv) && !((captype == INITCAP) && - // if CHECKSHARPS: KEEPCASE words with ß are allowed + // if CHECKSHARPS: KEEPCASE words with ?are allowed // in INITCAP form, too. - pAMgr->get_checksharps() && ((utf8 && strstr(wspace, "ß")) || - (!utf8 && strchr(wspace, 'ß')))))) { + pAMgr->get_checksharps() && ((utf8 && strstr(wspace, "脽")) || + (!utf8 && strchr(wspace, '?')))))) { wl2 = mkinitcap2(cw, unicw, nc); rv = checkword(cw, info, root); if (rv && (captype == ALLCAP) && is_keepcase(rv)) rv = NULL; @@ -499,15 +499,15 @@ int Hunspell::spell(const char * word, int * info, char ** root) char * dash; int result = 0; // n-dash - dash = (char *) strstr(cw,"–"); + dash = (char *) strstr(cw,"-"); if (dash && !wordbreak) { *dash = '\0'; // examine 2 sides of the dash if (spell(cw) && spell(dash + 3)) { - *dash = 'â'; + *dash = '?'; return 1; } - *dash = 'â'; + *dash = '?'; } dash = (char *) strchr(cw,'-'); if (dash) { @@ -746,18 +746,18 @@ int Hunspell::suggest(char*** slst, const char * word) if (pAMgr && pAMgr->get_checksharps()) { char * pos; if (utf8) { - pos = strstr((*slst)[j], "ß"); + pos = strstr((*slst)[j], "脽"); while (pos) { *pos = 'S'; *(pos+1) = 'S'; - pos = strstr(pos+2, "ß"); + pos = strstr(pos+2, "脽"); } } else { - pos = strchr((*slst)[j], 'ß'); + pos = strchr((*slst)[j], '?'); while (pos) { (*slst)[j] = (char *) realloc((*slst)[j], strlen((*slst)[j]) + 2); - mystrrep((*slst)[j], "ß", "SS"); - pos = strchr((*slst)[j], 'ß'); + mystrrep((*slst)[j], "?", "SS"); + pos = strchr((*slst)[j], '?'); } } } @@ -1278,7 +1278,7 @@ char * Hunspell::morph(const char * word) } if ((n == wl) && (n3 > 0) && (n - n3 > 3)) return NULL; - if ((n == wl) || ((n>0) && ((cw[n]=='%') || (cw[n]=='°')) && checkword(cw+n, NULL, NULL))) { + if ((n == wl) || ((n>0) && ((cw[n]=='%') || (cw[n]=='?)) && checkword(cw+n, NULL, NULL))) { strcat(result, cw); result[n - 1] = '\0'; if (n == wl) { -- 2.11.4.GIT