Use QFile::{encode,decode}Name for file names

And make them use UTF-8 on Windows instead of the local 8 bit encoding.
This will also get us the proper NFD encoding on OS X.

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Thiago Macieira 2013-12-19 17:02:34 -08:00 committed by Dirk Hohndel
parent dbdf50d03c
commit 8eb6dfdb02
4 changed files with 21 additions and 5 deletions

View file

@ -759,7 +759,7 @@ void DivelogsDeWebServices::downloadFinished()
if (!zip)
::close(duppedfd);
#else
struct zip *zip = zip_open(zipFile.fileName().toUtf8().data(), 0, &errorcode);
struct zip *zip = zip_open(QFile::encodeName(zipFile.fileName()), 0, &errorcode);
#endif
if (!zip) {
char buf[512];
@ -855,7 +855,7 @@ void DivelogsDeWebServices::buttonClicked(QAbstractButton* button)
}
/* parse file and import dives */
char *error = NULL;
parse_file(zipFile.fileName().toUtf8().data(), &error);
parse_file(QFile::encodeName(zipFile.fileName()), &error);
if (error != NULL) {
mainWindow()->showError(error);
free(error);