Python Use UTF8 and untranslated Series Names

.. With german translation activated GC.activity() complains about
   some utf-8 decoding stuff and returns error.

   First I thought came from the real activity json file, but it's
   from translation: Altitude -> Höhenmeter.

   Is it necessary to use toLatin1() in goldencheetah.sip? With
   toUtf8() it works and you get delta symbols instead of question marks.

.. With R the series names are always in english and use a naming
   convention derived from the R trackR package -- we now follow the
   same in Python bindings to ensure charts created in one locale
   will continue to work in another.
This commit is contained in:
slorenz
2017-12-10 10:16:57 +00:00
committed by Mark Liversedge
parent b3680c0dd1
commit 80e786c4c0
3 changed files with 3 additions and 3 deletions

View File

@@ -54,7 +54,7 @@ Bindings::seriesLast() const
QString
Bindings::seriesName(int type) const
{
return RideFile::seriesName(static_cast<RideFile::SeriesType>(type));
return RideFile::seriesName(static_cast<RideFile::SeriesType>(type), true);
}
bool

View File

@@ -36,7 +36,7 @@
return 0;
%End
%ConvertFromTypeCode
return PyUnicode_FromString(sipCpp->toLatin1().data());
return PyUnicode_FromString(sipCpp->toUtf8().data());
%End
};

View File

@@ -63,7 +63,7 @@ static PyObject *convertFrom_QString(void *sipCppV, PyObject *)
::QString *sipCpp = reinterpret_cast< ::QString *>(sipCppV);
#line 39 "goldencheetah.sip"
return PyUnicode_FromString(sipCpp->toLatin1().data());
return PyUnicode_FromString(sipCpp->toUtf8().data());
#line 68 "./sipgoldencheetahQString.cpp"
}