From 1ff8f294b459e03e113acb417678a6fd782c2685 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Mon, 21 Sep 2015 18:34:43 +0200 Subject: minor encoding fixes --- netlib/utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'netlib/utils.py') diff --git a/netlib/utils.py b/netlib/utils.py index 8d11bd5b..b9848038 100644 --- a/netlib/utils.py +++ b/netlib/utils.py @@ -26,7 +26,7 @@ def always_byte_args(*encode_args): return decorator -def native(s, encoding="latin-1"): +def native(s, *encoding_opts): """ Convert :py:class:`bytes` or :py:class:`unicode` to the native :py:class:`str` type, using latin1 encoding if conversion is necessary. @@ -37,10 +37,10 @@ def native(s, encoding="latin-1"): raise TypeError("%r is neither bytes nor unicode" % s) if six.PY3: if isinstance(s, six.binary_type): - return s.decode(encoding) + return s.decode(*encoding_opts) else: if isinstance(s, six.text_type): - return s.encode(encoding) + return s.encode(*encoding_opts) return s -- cgit v1.2.3