aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2017-04-16 18:12:36 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-04-18 18:13:05 -0700
commit58a25d33ce03c2b4944f0b187da29a635410e86b (patch)
tree1049b1a6df049bdaa9ff9b140723dbca2d49cb98
parentc88be99d84aa0de63b77fcaa96c40b73ea10ae8c (diff)
downloadsubsurface-58a25d33ce03c2b4944f0b187da29a635410e86b.tar.gz
Attempt latin1 parsing on import
We parse input XML using UTF-8 encoding by default. If this fails, try latin1 instead. Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
-rw-r--r--core/parse-xml.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/core/parse-xml.c b/core/parse-xml.c
index c6b7b9ae6..d1cfc88ed 100644
--- a/core/parse-xml.c
+++ b/core/parse-xml.c
@@ -2042,6 +2042,9 @@ int parse_xml_buffer(const char *url, const char *buffer, int size,
target_table = table;
doc = xmlReadMemory(res, strlen(res), url, NULL, 0);
+ if (!doc)
+ doc = xmlReadMemory(res, strlen(res), url, "latin1", 0);
+
if (res != buffer)
free((char *)res);