Set default python encoding to utf-8

To avoid unicode encoding errors [1], let's set encoding to
utf-8 for the session.

[1] UnicodeEncodeError: 'ascii' codec can't encode character u'\u2018' in position 11: ordinal not in range(128)

Change-Id: I9b9a0c232fb8a3a3e6e851932c5e5f9a3cd7cf34
This commit is contained in:
Dennis Dmitriev 2016-12-01 01:10:45 +02:00
parent 7f1e34d367
commit 0d6ec4e693
1 changed files with 6 additions and 0 deletions

View File

@ -12,7 +12,13 @@
# License for the specific language governing permissions and limitations
# under the License.
import codecs
import os
import sys
# Set default io encoding
sys.stdout = codecs.getwriter('utf8')(sys.stdout)
sys.stderr = codecs.getwriter('utf8')(sys.stderr)
_boolean_states = {'1': True, 'yes': True, 'true': True, 'on': True,
'0': False, 'no': False, 'false': False, 'off': False}