- for attr_name, attr_out in (("error", "Error"), ("no_error", "NoError"),
- ("moved", "Moved"), ("size", "Size"), ("md5", "Md5"),
- ("real_title", "RealTitle"), ("test_time", "TestTime")):
- if hasattr(b, attr_name):
- self.outfile.write("\n%s: %s" % (attr_out, getattr(b, attr_name)))
+ for attr_name, attr_out in (("error", "Error"), ("no_error", "NoError"),
+ ("moved", "Moved"), ("size", "Size"), ("md5", "Md5"),
+ ("real_title", "RealTitle"), ("test_time", "TestTime"),
+ ("icon_href", "IconURI"), ("icon", "Icon"), ("charset", "Charset")):
+ if hasattr(b, attr_name):
+ value = getattr(b, attr_name)
+ if isinstance(value, unicode):
+ value = value.encode('utf-8')
+ self.outfile.write("\n%s: %s" % (attr_out, value))