Support for Unicode memory path watch



  • Which shard is affected?

    All Screeps clients (web & steam client)

    What happened?

    memory paths containing non-Latin1 characters won;t show in Memory panel
    glitching memory view (glitching memory view)

    What should have happened?

    normal functional Memory watch
    0_1610631725819_ss.png (unofficially patched with Tampermonkey)

    How can we reproduce this?

    spawning a creep with Unicode names, and watch its memory by clicking or entering path

    Optional information:

    Currently I'm having fun with my creeps by naming them with wierd names in Chinese, and the names of creeps show normally. However, when I click on one of them and try to look into their memory object, the panel with creeps.some_name won't appear, and Chrome console repeatedly shows errors like:

    • ERROR DOMException: Failed to execute 'btoa' on 'Window': The string to be encoded contains characters outside of the Latin1 range.
      0_1610631825491_aa.png

    It seems that Screeps uses some sort of Base64 conversion (atob & btoa) for memory watches saving, which only supports char codes within a byte.

    My workaround is to use a global wrapper user script with Tampermonkey to make the two functions support Unicode strings, but the Screeps client's NW.JS environment is harder to inject.

    Not only (some of) Unicode-language-using players will need this, but also it makes extra fun (e.g. Emoji creep/spawn names), so is it possible to officially add Unicode support for the Memory panel?

    Piece of code which shows the bug in action:

    _.values(Game.spawns)[0].spawnCreep([MOVE], "some_name"), click this guy after spawning and watch Memory scope blow up