summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDom Lachowicz <domlachowicz@gmail.com>2003-08-29 03:24:49 +0000
committerDom Lachowicz <domlachowicz@gmail.com>2003-08-29 03:24:49 +0000
commitddf3b84a132dac1313e4fb61b7cf75506115d042 (patch)
treee4aa8c072396fc41e440d2a4d79c2fe11a20e467
parenta08e133de3a254823723b90506ff225faed20b9f (diff)
downloadenchant-ddf3b84a132dac1313e4fb61b7cf75506115d042.tar.gz
some utf8 fixes
git-svn-id: svn+ssh://svn.abisource.com/svnroot/enchant/trunk@20829 bcba8976-2d24-0410-9c9c-aab3bd5fdfd6
-rw-r--r--tests/enchant-ispell.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/tests/enchant-ispell.c b/tests/enchant-ispell.c
index 1a6a99b..7b3bcbc 100644
--- a/tests/enchant-ispell.c
+++ b/tests/enchant-ispell.c
@@ -85,11 +85,13 @@ consume_line (FILE * in, GString * str)
}
}
- utf = g_locale_to_utf8 (str->str, str->len, &bytes_read, &bytes_written, NULL);
- g_free (str->str);
-
- str->str = utf;
- str->len = bytes_written;
+ if (str->len) {
+ utf = g_locale_to_utf8 (str->str, str->len, &bytes_read, &bytes_written, NULL);
+ g_free (str->str);
+
+ str->str = utf;
+ str->len = bytes_written;
+ }
return ret;
}
@@ -112,7 +114,7 @@ do_mode_a (FILE * out, EnchantDict * dict, GString * word, size_t start_pos)
char ** suggs;
if (enchant_dict_check (dict, word->str, word->len) == 0)
- fwrite ("*\n", 1, 3, out);
+ fwrite ("*\n", 1, 2, out);
else {
suggs = enchant_dict_suggest (dict, word->str,
word->len, &n_suggs);
@@ -144,8 +146,10 @@ do_mode_a (FILE * out, EnchantDict * dict, GString * word, size_t start_pos)
static void
do_mode_l (FILE * out, EnchantDict * dict, GString * word)
{
- if (enchant_dict_check (dict, word->str, word->len) != 0)
- fprintf (out, "%s\n", word->str);
+ if (enchant_dict_check (dict, word->str, word->len) != 0) {
+ print_utf (out, word->str);
+ fwrite ("\n", 1, 1, out);
+ }
}
static int