Permalink
Browse files

Some pages are already in utf-8!

  • Loading branch information...
1 parent 3461111 commit 3c45850a0475a6eb632be30a22821098931f5775 @palfrey committed Dec 25, 2012
Showing with 5 additions and 1 deletion.
  1. +5 −1 books.py
View
6 books.py
@@ -59,7 +59,11 @@
age = -1
while True:
p = c.get(page, max_age=age)
- data = p.read().decode("utf-8")
+ data = p.read()
+ try:
+ data = data.decode("utf-8")
+ except UnicodeEncodeError:
+ pass # hope all still ok...
for k in wrong:
data = data.replace(k, wrong[k])

0 comments on commit 3c45850

Please sign in to comment.