title: QUrl, right coding for paths
body: <p>I have a problem with coding. I'm using drag and drom inside my application but some text files I can not open, after some searching I find that the path is with wrong coding. The real file is 'Some_file - 01.txt' but when I try print this path (after drop) to the stdout I will get 'Some_file â€“ 01.txt'. What I miss:</p>
  
  <pre><code>void MainWindow::dropEvent(QDropEvent *event) {
    QList&lt;QUrl&gt; urls = event-&gt;mimeData()-&gt;urls();
    ...
    cout &lt;&lt; paths[1].toLocalFile() &lt;&lt; endl; /* Some_file â€“ 01.txt */
    cout &lt;&lt; paths[1].toEncoded() &lt;&lt; endl; /* Some_file%20%E2%80%93%2001.txt */
  }
  </code></pre>
  
  <p>I also try QString::fromLatin1 or fromUtf8 but without success.
  I'm using QT 4.7.0 and Windows 7.</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>This is my main setup:</p>
  
  <pre><code>QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
  QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
  QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
  </code></pre>
  
  <p>And unfortunately even this is not working for me:</p>
  
  <pre><code>QString fileName = QFileDialog::getOpenFileName(this, tr("Load EEPROM from HEX file"), "", tr("HEX file (*.hex)"));
  ifstream hexFile(fileName.toStdString().c_str());
  </code></pre>
  
  <p>I'm not able to open files where the char '-' is part of file name.</p>
  
  <p><strong>EDIT2:</strong></p>
  
  <p>If I change the file name manualy from 'file.txt' to 'file-.txt' everything is working well. But when I (the same file) copy and paste this file to the same folder, windows will generate new name with postfix: 'file - copy.txt' and this file I can NOT open. So the Windows is using different character for '-' vz. '–'.</p>
  
  <p>What I can do ?</p>
  
  <p><strong>Solution:</strong></p>
  
  <pre><code>void openFile(string fileName) {
    ifstream fileio(fileName.c_str());
  }
  
  QString qtFileName = QFileDialog::getOpenFileName(...)
  openFile(qtFileName.toLocal8Bit().constData());
  </code></pre>