diff --git a/scrapy/trunk/scrapy/utils/misc.py b/scrapy/trunk/scrapy/utils/misc.py index 3be118b6a..cd374e66f 100644 --- a/scrapy/trunk/scrapy/utils/misc.py +++ b/scrapy/trunk/scrapy/utils/misc.py @@ -8,7 +8,6 @@ from twisted.python import failure from scrapy.core.exceptions import UsageError from scrapy.utils.python import flatten -from decobot.utils.text_extraction import unquote_html def dict_updatedefault(D, E, **F): """ @@ -155,6 +154,13 @@ def load_class(class_path): return cls +def unquote_html(s, keep_reserved=False): + """Convert a HTML quoted string into normal string (ISO-8859-1). + + Works with &#XX; and with   > etc. + """ + return re.sub(re.compile(r'&(#?)(.+?);', re.U), lambda m: convert_entity(m, keep_reserved), s) + def extract_regex(regex, text, encoding): """Extract a list of unicode strings from the given text/encoding using the following policies: