diff --git a/main.py b/main.py index ea471b2..ffcd71e 100644 --- a/main.py +++ b/main.py @@ -17,9 +17,9 @@ HTTP400 = "400 Bad Request" HTTP405 = "405 Method Not Allowed" HTTP500 = "500 Internal Server Error" -HTML = "text/html" -JSON = "application/json" -XML = "text/xml" +HTML = "text/html; charset=UTF-8" +JSON = "application/json; charset=UTF-8" +XML = "text/xml; charset=UTF-8" DOCSTR = ' Check out the documentation for usage instructions.' @@ -27,6 +27,7 @@ def doConn(req): try: getfrm = req.cfrm if "cfrm" in dir(req) and req.cfrm else req.args["from"][0] if "from" in req.args else None getto = req.cto if "cto" in dir(req) and req.cto else req.args["to"][0] if "to" in req.args else None + try: frm = html.unescape(getfrm.encode("latin-1").decode("utf-8")) to = html.unescape(getto.encode("latin-1").decode("utf-8")) @@ -37,6 +38,7 @@ def doConn(req): if not frm or not to: raise ValueError() + except Exception: content = "