From: robertlipe Date: Mon, 18 Feb 2013 05:38:40 +0000 (+0000) Subject: Don't double UTF-8 encode in gbfputs(QString, gbfile). X-Git-Tag: archive/raspbian/1.10.0+ds-2+rpi1~1^2~12^2~11^2~648 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=56e14a12921461f0c236cf2a28d69164b9730181;p=gpsbabel.git Don't double UTF-8 encode in gbfputs(QString, gbfile). --- diff --git a/gpsbabel/gbfile.cc b/gpsbabel/gbfile.cc index d0abd48cd..1a6e86a43 100644 --- a/gpsbabel/gbfile.cc +++ b/gpsbabel/gbfile.cc @@ -780,7 +780,10 @@ gbfputs(const char* s, gbfile* file) int gbfputs(const QString& s, gbfile* file) { - const char* qs = xstrdup(s.toUtf8().data()); + // Why is this Latin1() and not toUtf8()? Becuase our string data is + // already utf8 in most of the "C" places and calling toUtf8() here would + // double encode them. + const char* qs = xstrdup(s.toLatin1().data()); unsigned int l = strlen(qs); int rv = gbfwrite(qs, 1, l, file); xfree(qs); @@ -794,7 +797,7 @@ gbfputs(const QString& s, gbfile* file) int gbfwrite(const void* buf, const gbsize_t size, const gbsize_t members, gbfile* file) { - int result; + unsigned int result; result = file->filewrite(buf, size, members, file); if (result != members) {