Fix user creation for utf-8 usernames

The sha1 generated by the generate_sha1 function choked on utf8 strings.
Merge pull request #385 from regisb/master

Fix user creation for utf-8 usernames