python: getfilesystemencoding() returns different value in shell and wsgi
Question: When I type 'sys.getfilesystemencoding()' in shell, I got the result "utf-8"

    
    
    >>> 
    >>> import sys 
    >>> sys.getfilesystemencoding()
    'UTF-8'
    >>> 
    

But when I run in a WSGI script , I got the result "ANSI_X3.4-1968"

So why is it different?


Answer: This happens due to different script
[environment](http://en.wikipedia.org/wiki/Environment_variable).

Notice what happens when I change LC_CTYPE in the following example:

    
    
    └> LC_CTYPE=ANSI python -c 'import sys; print sys.getfilesystemencoding()'
    ANSI_X3.4-1968
    
    └> LC_CTYPE=en_US.UTF-8 python -c 'import sys; print sys.getfilesystemencoding()'
    UTF-8
    

To fix this, assign `en_US.UTF-8` value to `LC_CTYPE` environment variable for
your wsgi script.

