title: QFile cannot open filenames containing unicode characters
body: <p>I am having a problem with PySide. I was dealing with some images, using <code>QtCore.QImage</code> and noticed that image files which had unicode characters in their path names were not being opened.<br>
  So I started investigating and found that <code>QFile</code> presents the same problem.</p>
  
  <p>I've tried feeding it a 'utf8' encoded bytestring, and a decoded unicode string, same difference.<br>
  I also tried using those <code>QFile.encodeName</code> and <code>QFile.decodeName</code> functions but all that did was strip the non-ascii characters from the filename.</p>
  
  <p>I made this script to demonstrate: </p>
  
  <pre><code>#!/usr/bin/env python
  # -*- coding: utf-8 -*-
  
  import os
  
  from PySide.QtCore import QFile, QIODevice
  
  try:
      os.makedirs(u'/tmp/qttest')
  except:
      pass #probably dir just exists
  os.chdir(u'/tmp/qttest')
  
  def make_file(fn):
      f = open(fn, 'w')
      f.close()
  
  def check_file(fn):
      f = QFile(fn)
      f.open(QIODevice.ReadOnly)
      return f.isReadable()    
  
  fna = u'somefile.txt'
  fnu = u'einhverskrá.txt'
  
  make_file(fna)
  make_file(fnu)
  
  print fna+u' was opened successfully: ', check_file(fna)
  print fnu+u' was opened successfully: ', check_file(fnu)
  
  print fna+u' exists: ', os.path.exists(fna)
  print fnu+u' exists: ', os.path.exists(fnu)
  </code></pre>
  
  <p>Output</p>
  
  <pre><code>somefile.txt was opened successfully:  True
  einhverskrá.txt was opened successfully:  False
  somefile.txt exists:  True
  einhverskrá.txt exists:  True
  </code></pre>
  
  <p>Can someone explain this?</p>
  
  <p><strong>UPDATE</strong>
  After looking through the source code, I have found out that <code>QFile.open()</code> always passes the filename through this function on unix:</p>
  
  <pre><code>static QString locale_decode(const QByteArray &amp;f)
  {
  #if defined(Q_OS_DARWIN)
      // Mac always gives us UTF-8 and decomposed, we want that composed...
      return QString::fromUtf8(f).normalized(QString::NormalizationForm_C);
  #elif defined(Q_OS_SYMBIAN)
      return QString::fromUtf8(f);
  #else
      return QString::fromLocal8Bit(f);
  #endif
  }
  </code></pre>
  
  <p>This always results in unicode characters being stripped from the string.</p>