Content server: Fix (maybe) an error on some windows computers with a non-standard default encoding

See http://www.mobileread.com/forums/showthread.php?t=235366
This commit is contained in:
Kovid Goyal 2014-03-08 08:08:46 +05:30
parent 606ee69582
commit a33265cf46

View File

@ -47,6 +47,10 @@ class DispatchController(object): # {{{
aw = kwargs.pop('android_workaround', False) aw = kwargs.pop('android_workaround', False)
if route != '/': if route != '/':
route = self.prefix + route route = self.prefix + route
if isinstance(route, unicode):
# Apparently the routes package chokes on unicode routes, see
# http://www.mobileread.com/forums/showthread.php?t=235366
route = route.encode('utf-8')
elif self.prefix: elif self.prefix:
self.dispatcher.connect(name+'prefix_extra', self.prefix, self, self.dispatcher.connect(name+'prefix_extra', self.prefix, self,
**kwargs) **kwargs)