jenkins-bot has submitted this change and it was merged.
Change subject: Revert "convert html text to unicode, read charset, use utf-8 by default" ......................................................................
Revert "convert html text to unicode, read charset, use utf-8 by default"
New bug: Retrieving 50 pages from wikipedia:en. ERROR: Traceback (most recent call last): File "C:\pwb\core\pywikibot\data\api.py", line 291, in submit body=paramstring) File "C:\pwb\core\pywikibot\comms\http.py", line 156, in request text = unicode(text, charset, errors='strict') LookupError: unknown encoding: \
WARNING: Waiting 5 seconds before retrying. ERROR: Traceback (most recent call last): File "C:\pwb\core\pywikibot\data\api.py", line 291, in submit body=paramstring) File "C:\pwb\core\pywikibot\comms\http.py", line 156, in request text = unicode(text, charset, errors='strict') LookupError: unknown encoding: \
WARNING: Waiting 10 seconds before retrying.
This reverts commit 3a258d28d608c55e9113c4aa36061927d0b054fa.
Change-Id: Ife8f24b20eeb22302c915b32d0cd106d83903e1d --- M pywikibot/comms/http.py 1 file changed, 3 insertions(+), 10 deletions(-)
Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
diff --git a/pywikibot/comms/http.py b/pywikibot/comms/http.py index e9bc57f..6a4c287 100644 --- a/pywikibot/comms/http.py +++ b/pywikibot/comms/http.py @@ -13,7 +13,7 @@ """
# -# (C) Pywikipedia bot team, 2008-2014 +# (C) Pywikipedia bot team, 2007 # # Distributed under the terms of the MIT license. # @@ -24,7 +24,6 @@ import urllib import logging import atexit -import re
try: from httplib2 import SSLHandshakeError @@ -147,11 +146,5 @@ if request.data[0].status != 200: pywikibot.warning(u"Http response status %(status)s" % {'status': request.data[0].status}) - text = request.data[1] - # Convert text to Unicode - try: - charset = re.findall('charset=([^'";]+)', text)[0] - except IndexError: - charset = 'utf-8' # default - text = unicode(text, charset, errors='strict') - return text + + return request.data[1]
pywikibot-commits@lists.wikimedia.org