From 1c8223112900c26386560677134092cab5dbeea6 Mon Sep 17 00:00:00 2001 From: Shadab Zafar Date: Sat, 28 May 2016 10:55:58 +0530 Subject: [PATCH] Use encode to detect if string is valid ASCII --- pathod/language/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pathod/language/__init__.py b/pathod/language/__init__.py index 0841196e8..a43424eaf 100644 --- a/pathod/language/__init__.py +++ b/pathod/language/__init__.py @@ -31,7 +31,7 @@ def parse_pathod(s, use_http2=False): May raise ParseException """ try: - s = s.decode("ascii") + s.encode("ascii") except UnicodeError: raise exceptions.ParseException("Spec must be valid ASCII.", 0, 0) try: @@ -53,7 +53,7 @@ def parse_pathod(s, use_http2=False): def parse_pathoc(s, use_http2=False): try: - s = s.decode("ascii") + s.encode("ascii") except UnicodeError: raise exceptions.ParseException("Spec must be valid ASCII.", 0, 0) try: