ndless-nspire / Luna

Create TNS files from Lua and XML
Other
57 stars 13 forks source link

Luna should skip CDATA sections when escaping Unicode #28

Open Legimet opened 1 month ago

Legimet commented 1 month ago

Any XML file with Unicode in a CDATA section produces a malformed TNS file. Example:

<?xml version="1.0" encoding="UTF-8" ?><prob xmlns="urn:TI.Problem" ver="1.0" pbname=""><sym></sym><card clay="0" h1="10000" h2="10000" w1="10000" w2="10000"><isDummyCard>0</isDummyCard><flag>0</flag><wdgt xmlns:sc="urn:TI.ScriptApp" type="TI.ScriptApp" ver="1.0"><sc:mFlags>0</sc:mFlags><sc:value>-1</sc:value><sc:script version="512" id="0"><![CDATA[function on.paint(gc)
    gc:drawString("Hello World ✓", 5, 20)
end
]]></sc:script></wdgt></card></prob>

The solution is for escape_unicode to skip all CDATA sections.

adriweb commented 1 month ago

So this is fixed by #27 as well, right?

Legimet commented 1 month ago

No, not yet. That PR just handles Lua.