From 24ac1cb0a29b130473152eea37532a5af92b5d30 Mon Sep 17 00:00:00 2001 From: Nils G <nils.gondermann@ruhr-uni-bochum.de> Date: Thu, 18 Jun 2020 12:39:52 +0200 Subject: [PATCH] =?UTF-8?q?Replace=20'=20with=20=E2=80=99=20(clientside)?= =?UTF-8?q?=20and=20only=20allow=20the=20latter=20(u+2019)=20to=20be=20sto?= =?UTF-8?q?red?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- controllers/player.py | 2 +- static/game/bootstrap/renderer.js | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/controllers/player.py b/controllers/player.py index ce255bc..d0c2017 100644 --- a/controllers/player.py +++ b/controllers/player.py @@ -102,7 +102,7 @@ def submit(): if "length" in input_definitions[key] and len(inputs[key]) > input_definitions[key]["length"]: return(FAIL(CODE_MISSING)) - inputs[key] = ''.join(c for c in inputs[key] if (c.isalnum() or c in " ,.!?-()")) + inputs[key] = ''.join(c for c in inputs[key] if (c.isalnum() or c in " ,.!?-()\u2019")) new_input["inputs"] = inputs diff --git a/static/game/bootstrap/renderer.js b/static/game/bootstrap/renderer.js index d1f61a0..76865f0 100644 --- a/static/game/bootstrap/renderer.js +++ b/static/game/bootstrap/renderer.js @@ -203,7 +203,10 @@ function submit(_button) { switch (element.getAttribute("type")) { case "text": inputs[element.getAttribute("name")] = element.value.replace( - /[^\u0020\u0021\u0028\u0029\u002C-\u002E\u003F\u00BF-\u1FFF\u2C00-\uD7FF\w]/g, + /[\u0027]/g, + "\u2019" + ).replace( + /[^\u0020\u0021\u0028\u0029\u002C-\u002E\u003F\u00BF-\u1FFF\u2C00-\uD7FF\u2019\w]/g, " " ); break; -- GitLab