Fix register with non-ascii character password (fixes #316)