mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #5249 (Error parsing accented characters in content server)
This commit is contained in:
parent
06c36eac92
commit
f7b3f6a442
@ -76,7 +76,7 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div id="search_box">
|
<div id="search_box">
|
||||||
<form name="search_form" action="/browse/search" method="get">
|
<form name="search_form" action="/browse/search" method="get" accept-charset="UTF-8">
|
||||||
<input value="" type="text" title="Search"
|
<input value="" type="text" title="Search"
|
||||||
class="search_input" />
|
class="search_input" />
|
||||||
<input type="submit" value="Search" title="Search" alt="Search" />
|
<input type="submit" value="Search" title="Search" alt="Search" />
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="search_box">
|
<div id="search_box">
|
||||||
<form name="search_form" onsubmit="search();return false;" action="./" method="get">
|
<form name="search_form" onsubmit="search();return false;" action="./" method="get" accept-charset="UTF-8">
|
||||||
<input value="" id="s" type="text" />
|
<input value="" id="s" type="text" />
|
||||||
<input type="image" src="/static/btn_search_box.png" width="27" height="24" id="go" alt="Search" title="Search" />
|
<input type="image" src="/static/btn_search_box.png" width="27" height="24" id="go" alt="Search" title="Search" />
|
||||||
</form>
|
</form>
|
||||||
|
@ -17,7 +17,7 @@ from calibre.library.server import custom_fields_to_display
|
|||||||
from calibre.library.server.utils import strftime, format_tag_string
|
from calibre.library.server.utils import strftime, format_tag_string
|
||||||
from calibre.ebooks.metadata import fmt_sidx
|
from calibre.ebooks.metadata import fmt_sidx
|
||||||
from calibre.constants import __appname__
|
from calibre.constants import __appname__
|
||||||
from calibre import human_readable
|
from calibre import human_readable, isbytestring
|
||||||
from calibre.utils.date import utcfromtimestamp
|
from calibre.utils.date import utcfromtimestamp
|
||||||
from calibre.utils.filenames import ascii_filename
|
from calibre.utils.filenames import ascii_filename
|
||||||
|
|
||||||
@ -29,6 +29,8 @@ def CLASS(*args, **kwargs): # class is a reserved word in Python
|
|||||||
def build_search_box(num, search, sort, order): # {{{
|
def build_search_box(num, search, sort, order): # {{{
|
||||||
div = DIV(id='search_box')
|
div = DIV(id='search_box')
|
||||||
form = FORM('Show ', method='get', action='mobile')
|
form = FORM('Show ', method='get', action='mobile')
|
||||||
|
form.set('accept-charset', 'UTF-8')
|
||||||
|
|
||||||
div.append(form)
|
div.append(form)
|
||||||
|
|
||||||
num_select = SELECT(name='num')
|
num_select = SELECT(name='num')
|
||||||
@ -193,6 +195,8 @@ class MobileServer(object):
|
|||||||
raise cherrypy.HTTPError(400, 'num: %s is not an integer'%num)
|
raise cherrypy.HTTPError(400, 'num: %s is not an integer'%num)
|
||||||
if not search:
|
if not search:
|
||||||
search = ''
|
search = ''
|
||||||
|
if isbytestring(search):
|
||||||
|
search = search.decode('UTF-8')
|
||||||
ids = self.db.search_getting_ids(search.strip(), self.search_restriction)
|
ids = self.db.search_getting_ids(search.strip(), self.search_restriction)
|
||||||
FM = self.db.FIELD_MAP
|
FM = self.db.FIELD_MAP
|
||||||
items = [r for r in iter(self.db) if r[FM['id']] in ids]
|
items = [r for r in iter(self.db) if r[FM['id']] in ids]
|
||||||
|
@ -49,6 +49,8 @@ class XMLServer(object):
|
|||||||
|
|
||||||
if not search:
|
if not search:
|
||||||
search = ''
|
search = ''
|
||||||
|
if isbytestring(search):
|
||||||
|
search = search.decode('UTF-8')
|
||||||
|
|
||||||
ids = self.db.search_getting_ids(search.strip(), self.search_restriction)
|
ids = self.db.search_getting_ids(search.strip(), self.search_restriction)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user