add preferredencoding to string

This commit is contained in:
Prodesire 2017-12-21 20:37:24 +08:00
parent fd9b5d7da5
commit fcc01429cf
1 changed files with 4 additions and 0 deletions

View File

@ -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.