Handle TypeError only in HTML parser
authorThierry Florac <thierry.florac@onf.fr>
Thu, 02 Jun 2016 16:40:39 +0200
changeset 65 326d216d3fc2
parent 64 70f2321e267a
child 66 1e9c6d17203e
Handle TypeError only in HTML parser
src/pyams_utils/html.py
--- a/src/pyams_utils/html.py	Thu Jun 02 16:40:06 2016 +0200
+++ b/src/pyams_utils/html.py	Thu Jun 02 16:40:39 2016 +0200
@@ -76,8 +76,8 @@
     def handle_data(self, data):
         try:
             self.data += data
-        except:
-            self.data += data.decode('utf8')
+        except TypeError:
+            self.data += data.decode('utf-8')
 
     def handle_entityref(self, name):
         self.data += self.entitydefs.get(name, '')