*** empty log message ***
[m17n/m17n-lib.git] / src / textprop.c
index e18f5f5..5fb93a4 100644 (file)
@@ -17,7 +17,7 @@
 
    You should have received a copy of the GNU Lesser General Public
    License along with the m17n library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    02111-1307, USA.  */
 
 /***en
@@ -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);
 
@@ -2882,7 +2887,7 @@ mtext_serialize (MText *mt, int from, int to, MPlist *property_list)
       if (! serialized_plist)
        continue;
       mtext_reset (work);
-      mplist__serialize (work, serialized_plist);
+      mplist__serialize (work, serialized_plist, 0);
       child = xmlNewChild (node, NULL, (xmlChar *) "property", NULL);
       xmlSetProp (child, (xmlChar *) "key",
                  (xmlChar *) MSYMBOL_NAME (prop->key));
@@ -2929,7 +2934,7 @@ mtext_serialize (MText *mt, int from, int to, MPlist *property_list)
     @brief Deserialize text properties in an M-text.
 
     The mtext_deserialize () function deserializes M-text $MT.  $MT
-    must be an XML having the followng DTD.
+    must be an XML having the following DTD.
 
 @verbatim
 <!DOCTYPE mtext [