title: UnicodeEncodeError when saving ImageField containing non-ASCII characters in Django admin
body: <p>I'm trying to upload an image file in django admin inlines and getting UnicodeEncodeError when trying to upload a file with a filename containing non-ascii characters:</p>
  
  <pre><code> File "/usr/local/lib/python2.6/site-packages/django/db/models/fields/files.py", line 92, in save
     self.name = self.storage.save(name, content)
  
   File "/usr/local/lib/python2.6/site-packages/django/core/files/storage.py", line 47, in save
     name = self.get_available_name(name)
  
   File "/usr/local/lib/python2.6/site-packages/django/core/files/storage.py", line 73, in get_available_name
     while self.exists(name):
  
   File "/usr/local/lib/python2.6/site-packages/django/core/files/storage.py", line 196, in exists
     return os.path.exists(self.path(name))
  
   File "/usr/local/lib/python2.6/genericpath.py", line 18, in exists
     st = os.stat(path)
  </code></pre>
  
  <p>There is a paragraph about this issue in Django docs: <a href="http://docs.djangoproject.com/en/dev/howto/deployment/modpython/#if-you-get-a-unicodeencodeerror" rel="noreferrer">http://docs.djangoproject.com/en/dev/howto/deployment/modpython/#if-you-get-a-unicodeencodeerror</a> - they say I must define LANG and LC_ALL env variables, plus defining them using os.env won't work. So I've defined them in my .htaccess file and I'm sure they are there:</p>
  
  <pre><code>META
  Variable    Value
  CONTENT_LENGTH  '27289'
  ...
  LANG    'en_US.UTF-8'
  LC_ALL  'en_US.UTF-8'
  LC_LANG     'en_US.UTF-8'
  </code></pre>
  
  <p>The problem still exists. Django version is 1.2.3 (latest stable), sys.getfilesystemencoding() (which I believe is relevant to the issue) returns "ANSI_X3.4-1968". </p>
  
  <p>The model/admin code is nothing special: an ArticleImage model with ImageField, and ArticleAdmin containing ArticleImage inlines.</p>
  
  <p><strong>UPDATE</strong> I couldn't fix this issue so I've given up using apache setup and started the application using runfcgi + nginx. Uploads work fine now but I'm not adding this as a solution because the question was about apache.</p>