mirror of https://github.com/tLDP/python-tldp
switch to codecs.open and expect UTF-8 data
This commit is contained in:
parent
2c4f8407b5
commit
bb7fbccc6b
|
@ -7,6 +7,7 @@ import os
|
||||||
import io
|
import io
|
||||||
import time
|
import time
|
||||||
import errno
|
import errno
|
||||||
|
import codecs
|
||||||
import operator
|
import operator
|
||||||
import subprocess
|
import subprocess
|
||||||
import functools
|
import functools
|
||||||
|
@ -106,7 +107,7 @@ def swapdirs(a, b):
|
||||||
|
|
||||||
def logfilecontents(logmethod, prefix, fname):
|
def logfilecontents(logmethod, prefix, fname):
|
||||||
'''log all lines of a file with a prefix '''
|
'''log all lines of a file with a prefix '''
|
||||||
with open(fname) as f:
|
with codecs.open(fname, encoding='utf-8') as f:
|
||||||
for line in f:
|
for line in f:
|
||||||
logmethod("%s: %s", prefix, line.rstrip())
|
logmethod("%s: %s", prefix, line.rstrip())
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue