Skip to content

Commit

Permalink
LinedConfigParser: internally use Unicode and return Unicode strings
Browse files Browse the repository at this point in the history
  • Loading branch information
stump committed Jan 6, 2013
1 parent 12b379e commit 19b2dd5
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/LinedConfigParser.py
@@ -1,9 +1,10 @@
# This is Python 2.7's standard library ConfigParser.py, with
# all write support stripped out, with only RawConfigParser (renamed
# LinedConfigParser), and with the ability to get the line number on which
# options are defined.
# LinedConfigParser), with the ability to get the line number on which
# options are defined, and with configuration strings being returned
# in Unicode.
#
# Modifications done April 2011 by John Stumpo
# Modifications done April 2011 and January 2013 by John Stumpo
# This file may be used under the terms of the same license as Python itself.

"""Configuration file parser.
Expand Down Expand Up @@ -93,6 +94,7 @@
_default_dict = dict

import re
from Unicode import unicodify

__all__ = ["NoSectionError", "NoOptionError", "ParsingError",
"MissingSectionHeaderError",
Expand Down Expand Up @@ -373,7 +375,7 @@ def _read(self, fp, fpname):
lineno = 0
e = None # None, or an exception
while True:
line = fp.readline()
line = unicodify(fp.readline())
if not line:
break
lineno = lineno + 1
Expand Down

0 comments on commit 19b2dd5

Please sign in to comment.