Use encode to detect if string is valid ASCII
This commit is contained in:
parent
cfb5efc96f
commit
1c82231129
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue