#19098: UnicodeDecodeError when including URLs in Windows with non-ASCII paths
-------------------------+-------------------------------------------------
     Reporter:           |      Owner:  nobody
  artamoshin             |     Status:  new
         Type:  Bug      |    Version:  1.4
    Component:  Core     |   Keywords:  non-ascii unicode windows path
  (URLs)                 |  UnicodeDecodeError url include
     Severity:  Normal   |  Has patch:  1
 Triage Stage:           |      UI/UX:  0
  Unreviewed             |
Easy pickings:  0        |
-------------------------+-------------------------------------------------
 Including app URLs raises UnicodeDecodeError when project path contains
 non-ASCII characters (i.e. c:\Users\Александр\Documents\Projects')
 {{{
 Traceback (most recent call last):
   File "C:\Python27\lib\wsgiref\handlers.py", line 85, in run
     self.result = application(self.environ, self.start_response)
   File "C:\Python27\lib\site-
 packages\django\contrib\staticfiles\handlers.py", line 67, in __call__
     return self.application(environ, start_response)
   File "C:\Python27\lib\site-packages\django\core\handlers\wsgi.py", line
 241, in __call__
     response = self.get_response(request)
   File "C:\Python27\lib\site-packages\django\core\handlers\base.py", line
 146, in get_response
     response = debug.technical_404_response(request, e)
   File "C:\Python27\lib\site-packages\django\views\debug.py", line 443, in
 technical_404_response
     'reason': smart_str(exception, errors='replace'),
   File "C:\Python27\lib\site-packages\django\utils\encoding.py", line 116,
 in smart_str
     return str(s)
   File "C:\Python27\lib\site-packages\django\core\urlresolvers.py", line
 235, in __repr__
     return smart_str(u'<%s %s (%s:%s) %s>' % (self.__class__.__name__,
 self.urlconf_name, self.app_name, self.namespace, self.regex.pattern))
 UnicodeDecodeError: 'ascii' codec can't decode byte 0xef in position 37:
 ordinal
  not in range(128)
 }}}
 because string module representation is bytesting that contains non-ASCII
 path, and it fails to format with u'%s' % self.urlconf_name.

 My solution: convert string representation with
 sys.getfilesystemencoding() to Unicode.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/19098>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to