Fixes #421 - local corrupt files.

The final character of the encoding digits was being cut off.
i.e. space = code 32, so it is coded as:
    &#32;
but it was being read with the digit 2 being dropped off, so it
got read it as if it was code 3, not 32

I have no idea why it didn't break when I tried it the first time.
This is one of those "this should never have worked, ever" sorts
of bugs.  I have no idea why it didn't break when I tried it before.
Merge pull request #422 from Dunbaratu/fixes-421-local-saves-corrupting

Fixes #421 - local corrupt files.