Skip to content

Commit

Permalink
Fixes lanjelot#134
Browse files Browse the repository at this point in the history
  • Loading branch information
lanjelot committed May 7, 2020
1 parent b6316de commit 2a23299
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions patator.py
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,7 @@ def b(x):
return x.encode('ISO-8859-1', errors='ignore')

def B(x):
return x.decode(errors='ignore')
return x.decode('ISO-8859-1', errors='ignore')
else:
def b(x):
return x
Expand Down Expand Up @@ -1114,14 +1114,14 @@ def html_unescape(s):
return h.unescape(s)

def count_lines(filename):
with open(filename) as f:
with open(filename, 'rb') as f:
lines = 0
buf_size = 1024 * 1024
read_f = f.read

buf = read_f(buf_size)
while buf:
lines += buf.count('\n')
lines += buf.count(b'\n')
buf = read_f(buf_size)

return lines
Expand Down Expand Up @@ -1150,7 +1150,7 @@ def __init__(self, filename):
self.filename = filename

def __iter__(self):
return open(self.filename)
return open(self.filename, 'rb')

def padhex(d):
x = '%x' % d
Expand Down

0 comments on commit 2a23299

Please sign in to comment.