Encode unicode from json as utf-8. This was required to allow people to register on my laptop

This commit is contained in:
Erik Johnston 2014-08-24 11:28:00 +01:00
parent 3f08a7ad21
commit a9a5329a11

View File

@ -33,10 +33,10 @@ class RegisterRestServlet(RestServlet):
try: try:
register_json = json.loads(request.content.read()) register_json = json.loads(request.content.read())
if "password" in register_json: if "password" in register_json:
password = register_json["password"] password = register_json["password"].encode("utf-8")
if type(register_json["user_id"]) == unicode: if type(register_json["user_id"]) == unicode:
desired_user_id = register_json["user_id"] desired_user_id = register_json["user_id"].encode("utf-8")
if urllib.quote(desired_user_id) != desired_user_id: if urllib.quote(desired_user_id) != desired_user_id:
raise SynapseError( raise SynapseError(
400, 400,