[totem-pl-parser] plparser: Print the UTF-8 conversion error



commit 6367e5dbe500bb13de5e4d1cfd89a0807a30aaab
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Mar 4 13:52:55 2021 +0100

    plparser: Print the UTF-8 conversion error

 plparse/totem-pl-parser.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/plparse/totem-pl-parser.c b/plparse/totem-pl-parser.c
index bffc89a..dd65b71 100644
--- a/plparse/totem-pl-parser.c
+++ b/plparse/totem-pl-parser.c
@@ -1851,6 +1851,7 @@ totem_pl_parser_parse_xml_relaxed (char *contents,
                                   gsize size)
 {
        xml_node_t* doc, *node;
+       g_autoptr(GError) error = NULL;
        char *encoding, *new_contents;
        gsize new_size;
        xml_parser_t *xml_parser;
@@ -1879,9 +1880,9 @@ totem_pl_parser_parse_xml_relaxed (char *contents,
 
        xml_parser_free_tree (doc);
 
-       new_contents = g_convert (contents, size, "UTF-8", encoding, NULL, &new_size, NULL);
+       new_contents = g_convert (contents, size, "UTF-8", encoding, NULL, &new_size, &error);
        if (new_contents == NULL) {
-               g_warning ("Failed to convert XML data to UTF-8");
+               g_warning ("Failed to convert XML data to UTF-8: %s", error->message);
                g_free (encoding);
                return NULL;
        }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]