提交 20870d07 编写于 作者: L Lukáš Doktor 提交者: Cleber Rosa

utils.astring: Add preferred ENCODING

There is no right encoding, but the `locale.getpreferredencoding` suits
most cases. Let's avoid the usually unnecessary `locale` import and
people struggling to remember the most appropriate method and store it
in `avocado.utils.astring`.
Signed-off-by: NLukáš Doktor <ldoktor@redhat.com>
上级 40e4453a
......@@ -26,6 +26,7 @@ And not notice until their code starts failing.
"""
import itertools
import locale
import re
import sys
import string
......@@ -35,6 +36,12 @@ from six.moves import zip
from six.moves import xrange as range
#: On import evaluated value representing the system encoding
#: based on system locales using :func:`locale.getpreferredencoding`.
#: Use this value wisely as some files are dumped in different
#: encoding.
ENCODING = locale.getpreferredencoding()
#: String containing all fs-unfriendly chars (Windows-fat/Linux-ext3)
FS_UNSAFE_CHARS = '<>:"/\\|?*;'
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册