[PATCH v2] Use UTF-8 for text strings.

Dirk Hohndel dirk at hohndel.org
Mon Dec 16 16:16:44 UTC 2013


On Mon, 2013-12-16 at 15:12 -0800, Thiago Macieira wrote:
> On segunda-feira, 16 de dezembro de 2013 23:50:42, Michael Andreen wrote:
> > Fixes #371
> > 
> > Signed-off-by: Michael Andreen <harv at ruin.nu>
> > ---
> > 
> > On Monday, December 16, 2013 02:18:18 PM Thiago Macieira wrote:
> > > While the patch itself is fine, I'm not sure it's actually fixing
> > > anything.
> > > Michael, can you confirm that it does fix the problem?
> > > 
> > > The reason being that we set the "codec for C strings" early in the
> > > initialisation, so
> > > 
> > > 	QString(text) == QString::fromUtf8(text)
> > 
> > So I went a bit far with all the fromUtf8. The actual problem is just
> > toLocal8Bit(). I managed to reproduce the problem on linux by using a latin1
> > locale for LC_CTYPE and switching to toUtf8() fixes the problem.
> 
> Thanks, this one looks better!

Of course this immediately had me do this:

$ git grep toLocal8Bit
main.cpp:                       parse_argument(a.toLocal8Bit().data());
qt-ui/divelistview.cpp: QByteArray bt = fileName.toLocal8Bit();
qt-ui/mainwindow.cpp:           fileNamePtr = fileNames.at(i).toLocal8Bit();
qt-ui/mainwindow.cpp:           fileNamePtr = fileNames.at(i).toLocal8Bit();
qt-ui/subsurfacewebservices.cpp:        tempfile = strdup(tempfileQ.toLocal8Bit().data());
qt-ui/subsurfacewebservices.cpp:                QByteArray url = tr("Webservice").toLocal8Bit();
qt-ui/subsurfacewebservices.cpp:        struct zip *zip = zip_open(zipFile.fileName().toLocal8Bit().data(), 0, &errorcode);
qt-ui/subsurfacewebservices.cpp:                parse_file(zipFile.fileName().toLocal8Bit().data(), &error);
qthelper.cpp:           // qDebug("%s -> %8.5f / %8.5f", gps_text.toLocal8Bit().data(), *latitude, *longitude);

which of these should also be converted???

/D



More information about the subsurface mailing list