Support use of non-ascii passwords.

[Closes #4001]

This needs to be merged along with keymanager and leap_mail pullreqs, I'll post the links below.