Page 1 of 3 1 2 3 LastLast
Results 1 to 10 of 26

Thread: Unusual characters in faxbot monster names cause problems

  1. #1
    Senior Member zarqon's Avatar
    Join Date
    Nov 2007
    Location
    Seoul, Korea
    Posts
    3,376

    Exclamation Unusual characters in faxbot monster names cause problems

    Using the Request a Fax window, KoLmafia was unable to successfully request a Jar of Alphredo™.

    Asking Easyfax to send a fax of Possessed Jar of Alphredo™: Possessed Jar of Alphredo™
    Configuration error: unknown command sent to Easyfax
    The chat contained:

    zarqon: Possessed Jar of Alphredo?
    Easyfax: I couldn't find that monster. Please look here [link] http://sourceforge.net/p/easyfax/code/HEAD/tree/list for a list of monster names.
    It worked without the trademark symbol. Is this an error with EasyFax's config file or something that could/should be worked around in mafia?
    Sig by JakAtk
    My scripts: One-Click Wossname | Om******t (??) | Psychose-a-Matic | RandBot
    Combat suite: Best Between Battle | Mer********d (?!) | SmartStasis | BatMan | BatMan RE
    For script authors: ASH Wiki | ZLib | BatBrain | CLI Links | CanAdv | Script Registry | Map Manager | About Bats
    If you appreciate my work, help me become BAT KING OF THE WORLD! Thanks to all donators!

  2. #2

    Default

    I believe there are multiple pages discussing that in the thread where support was added for FaustBot and Easyfax. I don't remember the conclusion.

  3. #3
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    10,957

    Default

    The monster is named:

    Code:
    Possessed Jar of Alphredo™
    EasyFax's config file says:

    Code:
    <monsterdata>
    <name>Possessed Jar of Alphredo™</name>
    <actual_name>Possessed Jar of Alphredo™</actual_name>
    <command>Possessed Jar of Alphredo™</command>
    <category>None</category>
    </monsterdata>
    Note the actual ™ character. The EasyFax config file says "<?xml version="1.0" encoding="UTF-8"?>". Therefore, the character code for that Unicode symbol is 8482 (decimal).

    When we send the request to EasyFax, we do it via a chat command:

    Code:
    				ChatSender.sendMessage( botName, command, false );
    According to Generic Request:

    Code:
    		String charset = this.isChatRequest ? "ISO-8859-1" : "UTF-8";
    we encode chat requests using ISO-8859-1, not UTF-8. In that charset, the character code for that symbol is 153.

    I went into the gCLI.
    I did /msg Veracity abc™
    KoLmafia submitted this request:

    submitnewchat.php?pwd&playerid=121572&graf=%2Fmsg+ Veracity+abc%3F

    Note the %3F character, which is a question mark. It did not actually transmit the ™ symbol. I'm not sure where that is happening; I'd have expected to see it transmitted as char code 153, per ISO-8859-1 encoding.

    I went into the Relay Browser and typed that same /msg command. The Browser popped up a window saying the ™ character is not ASCII and it will convert it into a space. And, in fact, I received abc with no ™.

    Looks to me like EasyFax config file should store the actual KoL (and KoLmafia) monster names in its config files - which is to say, using HTML entities.
    Ph'nglui mglw'nafh Cthulhu
    R'lyeh wgah-nagl fhtagn.

  4. #4
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    10,957

    Default

    Although, you know, we could convert config file "commands"s to use HTML entities ourself.

    Probably easy enough, and it would be harmless even if EasyFax eventually does that itself.
    Ph'nglui mglw'nafh Cthulhu
    R'lyeh wgah-nagl fhtagn.

  5. #5
    Developer Veracity's Avatar
    Join Date
    Mar 2006
    Location
    The Unseelie Court
    Posts
    10,957

    Default

    Except, EasyFax would need to understand it.

    Code:
    [13:59] Veracity: Possessed Jar of Alphredo&trade;
    [14:00] Easyfax: I couldn't find that monster. Please look here [link] http:// sourceforge.net/p/ easyfax/code/HEAD/ tree/list for a list of monster names.
    The fix has to be in EasyFax, not KoLmafia.
    Ph'nglui mglw'nafh Cthulhu
    R'lyeh wgah-nagl fhtagn.

  6. #6
    Senior Member Crowther's Avatar
    Join Date
    Nov 2006
    Posts
    1,336

    Default

    Except, EasyFax would need to understand it.

    Code:
    [13:59] Veracity: Possessed Jar of Alphredo™
    [14:00] Easyfax: I couldn't find that monster. Please look here [link] http:// sourceforge.net/p/ easyfax/code/HEAD/ tree/list for a list of monster names.
    The fix has to be in EasyFax, not KoLmafia.
    Originally Posted by Veracity View Post
    Ugh. The code I use just gets the name off the fax sheet.
    Code:
    matcher m = create_matcher("This is a sheet of copier paper with a grainy, blurry likeness of a(n*) (.+?) on it", fax);
    So it is in the format visit_url() returns.

    Just because my XML says UTF-8, doesn't mean that's right. I honestly don't understand these new character sets. I think someone told me to change that from ISO-8859-1, which I simply copied from faxbot.

    Anyway, that's not the real issue. My problem is with the way KoL works. Since there isn't a unique mapping between monster names and monsters, I simply go by the name as it appears on the fax page. However, as you point out, KoL will not let you cut and paste that name directly into chat, which leaves me in a bit of a bind. Is there a mafia way to convert from whatever visit_url() gives to html characters?

    BTW, if I disappear for a bit, it isn't because I don't care about this issue, my life is about to get very busy again. I should be able to squeeze this in.

  7. #7

    Default

    I think entity_encode() will do exactly what you need.

  8. #8
    Senior Member Crowther's Avatar
    Join Date
    Nov 2006
    Posts
    1,336

    Default

    I think entity_encode() will do exactly what you need.
    Originally Posted by lostcalpolydude View Post
    Cool! Thanks both of you!

    I thought something like that was added, but my wiki searches and ashref foo failed me. Easyfax now converts names to html when it looks at the fax page. Since this should make them pure ASCII, I'm betting things will run much smoother. I'm going to restart it now, but it will take a while for clans to be checked and for the information to propagate, so don't expect it to work better right away.

  9. #9
    Senior Member Crowther's Avatar
    Join Date
    Nov 2006
    Posts
    1,336

    Default

    Code:
    [13:40] Crowther: Possessed Jar of Alphredo&trade;
    [13:40] Easyfax: Your fax is ready.
    And the data file has the html name too. One odd side effect here. The first time I requested just "Alphredo", the request failed, because it went to find the ™ version and found the &trade; version and rejected it, because that wasn't want it was expecting to find. However, since after visiting that clan, it now remembers the &trade; version is there, a second request worked fine. There aren't too many monsters with odd characters, so I'll try to request them all.

    EDIT: Actually, I couldn't find any other monsters in the network with odd characters, so I guess this problem has been fixed!
    Last edited by Crowther; 12-14-2016 at 06:41 PM.

  10. #10
    Senior Member
    Join Date
    Jun 2011
    Posts
    367

    Default

    Any chance that the changes discussed here have broken Mafia's "faxbot" command?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •