10-31-2010, 09:15 AM | #1 |
Junior Member
Posts: 1
Karma: 10
Join Date: Nov 2009
Device: Sony 505PRS
|
[Bug + Patch] UnicodeDecodeError in new contentserver browse mode
Hello Kovid,
The new contentserver (calibre 0.7.26) is broken with non-US (e.g. German) databases and localisation. Output of the webpage e.g. when clicking on http://127.0.0.1:8080/browse/category/newest Code:
500 Internal Server Error The server encountered an unexpected condition which prevented it from fulfilling the request. Traceback (most recent call last): File "/usr/local/lib/calibre/cherrypy/_cprequest.py", line 606, in respond cherrypy.response.body = self.handler() File "/usr/local/lib/calibre/cherrypy/_cpdispatch.py", line 25, in __call__ return self.callable(*self.args, **self.kwargs) File "/usr/local/lib/calibre/calibre/library/server/utils.py", line 49, in do ans = func(*args, **kwargs) File "/usr/local/lib/calibre/calibre/library/server/browse.py", line 174, in do ans = func(self, *args, **kwargs) File "/usr/local/lib/calibre/calibre/library/server/browse.py", line 545, in browse_matches return self.browse_template(sort, category=False).format( File "/usr/local/lib/calibre/calibre/library/server/browse.py", line 257, in browse_template ans = ans.replace('{library_name}', xml(os.path.basename(lp))) UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 3526: ordinal not in range(128) Code:
--- src/calibre/library/server/browse.py 2010-10-30 20:53:58.000000000 +0200 +++ src/calibre/library/server/browse.patched.py 2010-10-31 13:53:54.627473906 +0100 @@ -252,8 +252,6 @@ lp = self.db.library_path if isbytestring(lp): lp = force_unicode(lp, filesystem_encoding) - if isinstance(ans, unicode): - ans = ans.encode('utf-8') ans = ans.replace('{library_name}', xml(os.path.basename(lp))) ans = ans.replace('{library_path}', xml(lp, True)) ans = ans.replace('{initial_search}', initial_search) Thanks for the great program, Felix Last edited by koehli; 10-31-2010 at 09:19 AM. Reason: forgot version information |
10-31-2010, 11:28 AM | #2 |
creator of calibre
Posts: 43,970
Karma: 22669822
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Thanks, fixed.
|
Advert | |
|
Tags |
bugreports, patches |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
UnicodeDecodeError in startup.py | yet | Calibre | 3 | 02-05-2010 11:29 AM |
UnicodeDecodeError in startup.py | yet | Calibre | 0 | 02-04-2010 05:57 AM |
Convert LIT bug & patch | llasram | Workshop | 4 | 12-30-2007 04:05 PM |
PRS-505 bug or eBookLib bug? | porkupan | Sony Reader | 3 | 10-07-2007 10:44 PM |
Bug turns iRex iLiad into color-mode | Alexander Turcic | Lounge | 4 | 06-08-2007 09:43 AM |