Opened 9 years ago

Closed 9 years ago

#510 closed defect (fixed)

Non-ASCII characters in the slug make the media page inaccessible (Server Error).

Reported by: Aleksej Owned by: joar
Priority: critical Milestone: 0.3.2
Component: programming Keywords:
Cc: Parent Tickets:


E.g. at, the image whose title begins with “6.10 Со стороны левого бо…” has a Cyrillic slug, so its page cannot be opened.


Change History (7)

comment:1 Changed 9 years ago by joar

Could you please supply a stacktrace?

translitcodec lets *some* non-ascii characters through. We should either strip away all non-ascii characters when generating the slug or make Routes accept non-ascii characters.

comment:2 Changed 9 years ago by Aleksej

The slug is “wфw”.

Error - <type 'exceptions.UnicodeEncodeError'>: 'ascii' codec can't encode character u'\u0444' in position 1: ordinal not in range(128)
File '/opt/dev/gmg/mediagoblin/local/lib/python2.7/site-packages/Paste-', line 144 in call

app_iter = self.application(environ, sr_checker)

File '/opt/dev/gmg/mediagoblin/local/lib/python2.7/site-packages/Paste-', line 203 in call

return app(environ, start_response)

File '/opt/dev/gmg/mediagoblin/local/lib/python2.7/site-packages/Beaker-1.6.3-py2.7.egg/beaker/', line 155 in call

return self.wrap_app(environ, session_start_response)

File '/opt/dev/gmg/mediagoblin/mediagoblin/', line 221 in call

return self.call_backend(environ, start_response)

File '/opt/dev/gmg/mediagoblin/mediagoblin/', line 138 in call_backend

route_match = self.routing.match(path_info)

File '/opt/dev/gmg/mediagoblin/local/lib/python2.7/site-packages/Routes-1.13-py2.7.egg/routes/', line 669 in match

result = self._match(url, environ)

File '/opt/dev/gmg/mediagoblin/local/lib/python2.7/site-packages/Routes-1.13-py2.7.egg/routes/', line 646 in _match


File '/opt/dev/gmg/mediagoblin/local/lib/python2.7/site-packages/Routes-1.13-py2.7.egg/routes/', line 560 in match

val = val and val.decode(self.encoding, self.decode_errors)

File '/opt/dev/gmg/mediagoblin/lib/python2.7/encodings/', line 16 in decode

return codecs.utf_8_decode(input, errors, True)

UnicodeEncodeError: 'ascii' codec can't encode character u'\u0444' in position 1: ordinal not in range(128)

CGI Variables

HTTP_ACCEPT: 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'
HTTP_ACCEPT_ENCODING: 'gzip, deflate'
HTTP_ACCEPT_LANGUAGE: 'ru-ru,ru;q=0.8,en-us;q=0.5,en;q=0.3'
HTTP_CONNECTION: 'keep-alive'
HTTP_COOKIE: 'mediagoblin_csrftoken=4692806606904755232; mediagoblin_csrftoken=4692806606904755232; mediagoblin=d17702e90b574360a1135621115c29b8'
HTTP_USER_AGENT: 'Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Firefox/17.0'
PATH_INFO: '/u/qqc/m/w\xd1\x84w/'

WSGI Variables

application: {(None, '/mgoblin_static'): <StaticURLParser '/opt/dev/gmg/mediagoblin/mediagoblin/static'>, (None, '/mgoblin_media'): <StaticURLParser '/opt/dev/gmg/mediagoblin/user_dev/media/public'>, (None, ): <beaker.middleware.SessionMiddleware object at 0x426f850>, (None, '/theme_static'): <StaticURLParser '/opt/dev/gmg/mediagoblin/user_dev/theme_static'>}
beaker.get_session: <bound method SessionMiddleware._get_session of <beaker.middleware.SessionMiddleware object at 0x426f850>>
beaker.session: {'_accessed_time': 1350152884.63729, 'user_id': u'2', 'messages': [], '_creation_time': 1350152804.395771}
paste.httpserver.thread_pool: <paste.httpserver.ThreadPool object at 0x21914d0>
paste.throw_errors: True
werkzeug.request: <Request '' [GET]>
wsgi process: 'Multithreaded'

comment:3 Changed 9 years ago by joar

Owner: set to joar
Status: newassigned

comment:4 Changed 9 years ago by joar

Priority: majorcritical

comment:5 Changed 9 years ago by joar

Milestone: 0.3.2

comment:6 Changed 9 years ago by joar

This issue will probably be fixed with the transition from Routes to werkzeug.routing, this works on werkzeug.routing:

comment:7 Changed 9 years ago by joar

Resolution: fixed
Status: assignedclosed

This has been fixed since the move to werkzeug.routing <3

Note: See TracTickets for help on using tickets.