sebdel / mra-tools-c

39 stars 13 forks source link

XML escaped characters are not unescaped when arc file is created #83

Closed retrofun closed 4 years ago

retrofun commented 4 years ago

https://github.com/jotego/jtbin/blob/master/mra/CPS1/Quiz%20%26%20Dragons%20%20Capcom%20Quiz%20Game%20-USA%20920701-.mra

contains

<name>Quiz &amp; Dragons: Capcom Quiz Game (USA 920701)</name>

-> arc file:

Quiz &amp; Dragons_ Capcom Quiz Game (USA 920701).arc
sebdel commented 4 years ago

Does it work in Mister ? We use the same xml parser as far as I know.

retrofun commented 4 years ago

Cannot say. I don't have a MiSTer.

An escape function is already there: html2str(). Would be a good idea to escape all XML string content.

e.g. this works for the name:

--- a/src/mra.c
+++ b/src/mra.c
@@ -282,6 +282,7 @@ void read_root(XMLNode *root, t_mra *mra) {

         if (strncmp(node->tag, "name", 5) == 0) {
             mra->name = strndup(node->text, 1024);
+            html2str(mra->name, mra->name);
         } else if (strncmp(node->tag, "mratimestamp", 13) == 0) {
             mra->mratimestamp = strndup(node->text, 1024);
         } else if (strncmp(node->tag, "mameversion", 12) == 0) {
sebdel commented 4 years ago

Yes, I was looking at it. But it doesn't get called for text nodes, only attributes. I wonder if it's a bug in sxmlc. Anyway, I'll fix it in sxmlc or elsewhere.

sebdel commented 4 years ago

Depends on: https://github.com/matthieu-labas/sxmlc/issues/14

matthieu-labas commented 4 years ago

I'm working on this one, should be closed in a few minutes :)