Fix #791788 (Search in "get books" doesn't work with umlauts)

This commit is contained in:
Kovid Goyal 2011-06-02 19:04:52 -06:00
commit cec7e74d87
7 changed files with 9 additions and 9 deletions

View File

@ -37,7 +37,7 @@ class GandalfStore(BasicStoreConfig, StorePlugin):
def search(self, query, max_results=10, timeout=60): def search(self, query, max_results=10, timeout=60):
url = 'http://www.gandalf.com.pl/s/' url = 'http://www.gandalf.com.pl/s/'
values={ values={
'search': query.encode('iso8859_2'), 'search': query.decode('utf-8').encode('iso8859_2'),
'dzialx':'11' 'dzialx':'11'
} }

View File

@ -6,7 +6,7 @@ __license__ = 'GPL 3'
__copyright__ = '2011, John Schember <john@nachtimwald.com>' __copyright__ = '2011, John Schember <john@nachtimwald.com>'
__docformat__ = 'restructuredtext en' __docformat__ = 'restructuredtext en'
import urllib2 import urllib
from contextlib import closing from contextlib import closing
from lxml import html from lxml import html
@ -42,7 +42,7 @@ class GutenbergStore(BasicStoreConfig, StorePlugin):
def search(self, query, max_results=10, timeout=60): def search(self, query, max_results=10, timeout=60):
# Gutenberg's website does not allow searching both author and title. # Gutenberg's website does not allow searching both author and title.
# Using a google search so we can search on both fields at once. # Using a google search so we can search on both fields at once.
url = 'http://www.google.com/xhtml?q=site:gutenberg.org+' + urllib2.quote(query) url = 'http://www.google.com/xhtml?q=site:gutenberg.org+' + urllib.quote_plus(query)
br = browser() br = browser()

View File

@ -40,7 +40,7 @@ class LegimiStore(BasicStoreConfig, StorePlugin):
d.exec_() d.exec_()
def search(self, query, max_results=10, timeout=60): def search(self, query, max_results=10, timeout=60):
url = 'http://www.legimi.com/pl/ebooks/?price=any&lang=pl&search=' + urllib.quote_plus(query.encode('utf-8')) + '&sort=relevance' url = 'http://www.legimi.com/pl/ebooks/?price=any&lang=pl&search=' + urllib.quote_plus(query) + '&sort=relevance'
br = browser() br = browser()

View File

@ -7,7 +7,7 @@ __copyright__ = '2011, John Schember <john@nachtimwald.com>'
__docformat__ = 'restructuredtext en' __docformat__ = 'restructuredtext en'
import re import re
import urllib2 import urllib
from contextlib import closing from contextlib import closing
from lxml import html from lxml import html
@ -43,7 +43,7 @@ class ManyBooksStore(BasicStoreConfig, StorePlugin):
# It also doesn't do a clear job of references authors and # It also doesn't do a clear job of references authors and
# secondary titles. Google is also faster. # secondary titles. Google is also faster.
# Using a google search so we can search on both fields at once. # Using a google search so we can search on both fields at once.
url = 'http://www.google.com/xhtml?q=site:manybooks.net+' + urllib2.quote(query) url = 'http://www.google.com/xhtml?q=site:manybooks.net+' + urllib.quote_plus(query)
br = browser() br = browser()

View File

@ -44,7 +44,7 @@ class NextoStore(BasicStoreConfig, StorePlugin):
d.exec_() d.exec_()
def search(self, query, max_results=10, timeout=60): def search(self, query, max_results=10, timeout=60):
url = 'http://www.nexto.pl/szukaj.xml?search-clause=' + urllib.quote_plus(query.encode('utf-8')) + '&scid=1015' url = 'http://www.nexto.pl/szukaj.xml?search-clause=' + urllib.quote_plus(query) + '&scid=1015'
br = browser() br = browser()

View File

@ -186,7 +186,7 @@ class SearchDialog(QDialog, Ui_Dialog):
# Remove excess whitespace. # Remove excess whitespace.
query = re.sub(r'\s{2,}', ' ', query) query = re.sub(r'\s{2,}', ' ', query)
query = query.strip() query = query.strip()
return query return query.encode('utf-8')
def save_state(self): def save_state(self):
self.config['geometry'] = bytearray(self.saveGeometry()) self.config['geometry'] = bytearray(self.saveGeometry())

View File

@ -35,7 +35,7 @@ class VirtualoStore(BasicStoreConfig, StorePlugin):
d.exec_() d.exec_()
def search(self, query, max_results=10, timeout=60): def search(self, query, max_results=10, timeout=60):
url = 'http://virtualo.pl/c2/?q=' + urllib.quote(query.encode('utf-8')) url = 'http://virtualo.pl/c2/?q=' + urllib.quote(query)
br = browser() br = browser()