diff options
Diffstat (limited to 'wkhtmltopdf/utils.py')
-rw-r--r-- | wkhtmltopdf/utils.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/wkhtmltopdf/utils.py b/wkhtmltopdf/utils.py index 3d125bb..f002066 100644 --- a/wkhtmltopdf/utils.py +++ b/wkhtmltopdf/utils.py @@ -186,9 +186,11 @@ def http_quote(string): if isinstance(string, six.text_type): try: import unidecode - string = bytes(unidecode.unidecode(string), 'ascii') except ImportError: - string = string.encode('ascii', 'replace') + pass + else: + string = unidecode.unidecode(string) + string = string.encode('ascii', 'replace') # Wrap in double-quotes for ; , and the like string = string.replace(b'\\', b'\\\\').replace(b'"', b'\\"') return '"{0!s}"'.format(string.decode()) |