FIX: Fixed ID encoding.

The module uses base64 encoding to make arbitrary IDs safe.  However, / and + characters break this.
This patch to both encodeId and decodeId does a bit more sanitisation, to make sure that base64 doesn't
return any nasty characters into the resulting IDs.