Fix encoding problem with non-ascii passwords