For passwords where the encoding already is correct, the conversion is a no-op. Also, since `encodeURIComponent` might throw, we need to make sure that we handle that case too. Fixes 6010.