From: handa Date: Tue, 4 Oct 2005 11:38:58 +0000 (+0000) Subject: (mtext_serialize): Be sure to make mt X-Git-Tag: REL-1-3-0~135 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=b1d3f53eaf5b8ba8c16b292827688bf71946d09a;p=m17n%2Fm17n-lib.git (mtext_serialize): Be sure to make mt MTEXT_FORMAT_UTF_8 and NULL terminated. --- diff --git a/src/textprop.c b/src/textprop.c index e18f5f5..12fa41f 100644 --- a/src/textprop.c +++ b/src/textprop.c @@ -2855,6 +2855,11 @@ mtext_serialize (MText *mt, int from, int to, MPlist *property_list) int n; M_CHECK_RANGE (mt, from, to, NULL, NULL); + if (mt->format != MTEXT_FORMAT_US_ASCII + && mt->format != MTEXT_FORMAT_UTF_8) + mtext__adjust_format (mt, MTEXT_FORMAT_UTF_8); + if (MTEXT_DATA (mt)[mtext_nbytes (mt)] != 0) + MTEXT_DATA (mt)[mtext_nbytes (mt)] = 0; doc = xmlParseMemory (XML_TEMPLATE, strlen (XML_TEMPLATE) + 1); node = xmlDocGetRootElement (doc);