I tested by changing the start of the easyfax.xml to look like this:
The DOCTYPE thing is new. We can now successfully parse the file - but it replaces the ™ with the unicode character and we are back to where we started. That ™ symbol is actually a Unicode character definition: "& #8482 ;" (minus the spaces).
<?xml version="1.0" encoding="UTF-8"?>
<!ENTITY trade "™">
I then adjusted FaxBotDatabase:
And it works like this:
this.command = CharacterEntities.escape( command );
EasyFax stores the name of the monster with the characters entities.
EasyFax generates a config file that defines & references the character entity.
KoLmafia's XML parser reads that config file and gets unicode characters,
KoLmafia escapes the unicode characters and ends up with the same ASCII string that EasFax has
--> KoLmafia can send that command via Fax and EasyFax understands it.
Easyfax config does NOT have a DOCTYPE. Instead, change the monster:
to not actually have a character entity - just something that XML will expand to look like one.
<name>Possessed Jar of Alphredo&trade;</name>
<actual_name>Possessed Jar of Alphredo&trade;</actual_name>
<command>Possessed Jar of Alphredo&trade;</command>
KoLmafia's FaxBotDatabase does not entity-encode the command. Same as now.
Net result is, KoLmafia's "command" agrees with EasyFax's command, and we can get the monster.
EasyFax does entity-encode on the monster name it reads from the photocopier.
It stores that in its command table.
It does ANOTHER entity encode on the command before it writes it to the XML file. But that's not the one it uses. That's just how it publishes it.