Various changes including password encoding

This allows passwords with non-ascii characters (e.g. containing £) to work.

Signed-off-by: root <root@ops.squiz.co.uk>