Fix URI encoding on register/login, also fix database escape bug
Fix #228