From 5aa66708b1c35fc7ce6e234bfe7684325e327ce4 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sat, 10 Nov 2012 14:49:04 -0500 Subject: Properly test that config file HTML titles can be non-ascii. --- coverage/config.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'coverage/config.py') diff --git a/coverage/config.py b/coverage/config.py index f8e400cd..7a6afe4d 100644 --- a/coverage/config.py +++ b/coverage/config.py @@ -1,7 +1,7 @@ """Config file for coverage.py""" -import os -from coverage.backward import string_class # pylint: disable=W0622 +import os, sys +from coverage.backward import string_class # In py3, # ConfigParser was renamed to the more-standard configparser try: @@ -13,6 +13,13 @@ except ImportError: class HandyConfigParser(configparser.ConfigParser): """Our specialization of ConfigParser.""" + def read(self, filename): + """Read a filename as UTF-8 configuration data.""" + if sys.version_info >= (3, 2): + super().read(filename, encoding="utf-8") + else: + configparser.ConfigParser.read(self, filename) + def getlist(self, section, option): """Read a list of strings. -- cgit v1.2.1