Replying to Alexander Malysh:
> Hi Paul,
> 
> would you please resend this patch as attachment instead of inlined one.

no problem.

-- 
Paul P 'Stingray' Komkoff Jr // http://stingr.net/key <- my pgp key
 This message represents the official view of the voices in my head
--- gateway/gw/wml_compiler.c   2004-01-22 17:08:24.000000000 +0300
+++ gw/gw/wml_compiler.c        2004-02-07 15:45:17.000000000 +0300
@@ -819,6 +819,7 @@
     int i, pos, wbxml_hex;
     wml_hash_t *temp = NULL;
     Octstr *cut_text = NULL;
+    char* tmp;
 
     /*
      * Beware that libxml2 does internal encoding in UTF-8 while parsing.
@@ -826,12 +827,13 @@
      * to transcode at least here. Only transcode if target encoding differs
      * from libxml2's internal encoding (UTF-8).
      */
+    tmp = xmlGetCharEncodingName(charset);
     if (charset != XML_CHAR_ENCODING_UTF8 && 
         charset_convert(attr_value, "UTF-8", 
-                        (char*) xmlGetCharEncodingName(charset)) != 0) {
+                        tmp) != 0) {
         error(0, "Failed to convert XML attribute value from charset "
                  "<%s> to <%s>, will leave as is.", "UTF-8", 
-                 xmlGetCharEncodingName(charset));
+                 tmp ? tmp : "(undef)");
     }
 
 
@@ -921,6 +923,7 @@
 {
     int ret;
     Octstr *temp;
+    char* tmp;
 
     temp = create_octstr_from_node(node); /* returns string in UTF-8 */
 
@@ -930,12 +933,13 @@
      * to transcode at least here. Only transcode if target encoding differs
      * from libxml2's internal encoding (UTF-8).
      */
+    tmp = xmlGetCharEncodingName(node->doc->charset);
     if (node->doc->charset != XML_CHAR_ENCODING_UTF8 && 
         charset_convert(temp, "UTF-8", 
-                        (char*) xmlGetCharEncodingName(node->doc->charset)) != 0) {
+                        tmp) != 0) {
         error(0, "Failed to convert XML text entity from charset "
                  "<%s> to <%s>, will leave as is.", "UTF-8", 
-                 xmlGetCharEncodingName(node->doc->charset));
+                 tmp ? tmp : "(undef)");
     }
 
     octstr_shrink_blanks(temp);

Reply via email to