From fcc01429cf81e303b3c1c32be132a3fce441cca0 Mon Sep 17 00:00:00 2001 From: Prodesire Date: Thu, 21 Dec 2017 20:37:24 +0800 Subject: [PATCH] add preferredencoding to string --- pydu/string.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pydu/string.py b/pydu/string.py index 3aa0430..351c77b 100644 --- a/pydu/string.py +++ b/pydu/string.py @@ -1,7 +1,11 @@ # coding: utf-8 +import locale from .compat import text_type +preferredencoding = locale.getpreferredencoding() + + def safeunicode(obj, encoding='utf-8'): """ Converts any given object to unicode string.