On 08/12/2014, at 10:57 PM, Nikolai Prokoschenko <[email protected]>
wrote:
> Hello again,
>
> On Monday, December 8, 2014 12:11:10 PM UTC+1, Nikolai Prokoschenko wrote:
> There is still the actual encoding problem, I'd like to provide a minimal
> test case but that'll have to wait until tomorrow for time reasons. In short
> terms: os.stat(path) where path is something UTF-8 encoded (with diacritics
> and such) crashes with UnicodeDecodeError.
>
> I've had a couple of minutes to craft this minimal wsgi application, which
> fails with lang=de_DE.UTF-8 locale=de_DE.UTF-8:
>
> #!/usr/bin/python
> # coding: utf-8
>
> import os
>
> filename = u"/tmp/äöü.gif"
>
> def minimal_application(environ, start_response):
> start_response('200 OK', [('content-type', 'text/plain')])
> os.stat(filename)
> return (filename, )
>
> application = minimal_application
Technically that example is not WSGI compliant.
Can you provide me the full traceback so I can see where the error is occurring?
The problem with the example is that the iterable returned should be over a
sequence of bytes strings, not Unicode strings.
Can you also add in the following prior to the os.stat() and provide what the
logs say:
import os
import sys
import locale
import mod_wsgi
print('process_group', mod_wsgi.process_group)
print('application_group', mod_wsgi.application_group)
print('LANG', os.environ.get('LANG'))
print('LC_ALL', os.environ.get('LC_ALL'))
print('sys.getdefaultencoding()', sys.getdefaultencoding())
print('locale.getlocale()', locale.getlocale())
print('locale.getdefaultlocale()', locale.getdefaultlocale())
print('locale.getpreferredencoding()', locale.getpreferredencoding())
Graham
--
You received this message because you are subscribed to the Google Groups
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/modwsgi.
For more options, visit https://groups.google.com/d/optout.