Add encode() and decode() functions to AccountManager

These functions allow encoding strings in various formats (eg, for
network transmission or storage in latin1 / plaintext formats), and
are provided as a convenience for application developers.
Note that the implementation of the encoding schemes is non standard.