From 0cb68afe7e2d4a97613fd5ef11d7d1684c5ecf06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Gra=C3=B1a?= Date: Fri, 27 Apr 2012 01:04:00 -0300 Subject: [PATCH] meta tag attributes for content-type http equiv can be in any order. #123 --- scrapy/http/response/html.py | 2 +- scrapy/tests/test_http_response.py | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/scrapy/http/response/html.py b/scrapy/http/response/html.py index f4236f426..60ca40edf 100644 --- a/scrapy/http/response/html.py +++ b/scrapy/http/response/html.py @@ -18,7 +18,7 @@ class HtmlResponse(TextResponse): _content_re = _template % ('content', r'(?P[^;]+);\s*charset=(?P[\w-]+)') _content2_re = _template % ('charset', r'(?P[\w-]+)') - METATAG_RE = re.compile(r'Some page Price: \xa3100' """ @@ -257,6 +256,16 @@ class HtmlResponseTest(TextResponseTest): r1 = self.response_class("http://www.example.com", body=body) self._assert_response_values(r1, 'gb2312', body) + def test_httpequiv_meta(self): + body = '''''' + response = self.response_class('http://example.com', body=body) + self._assert_response_values(response, 'gb18030', body) + + body = '''''' + response = self.response_class('http://example.com', body=body) + self._assert_response_values(response, 'gb18030', body) + + class XmlResponseTest(TextResponseTest):