1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-02-07 12:05:14 +01:00

Properly handle non-ASCII characters

(Support for UCS-2 encoded files is still missing as there is no such sample
file available.)
This commit is contained in:
Martin Tůma 2022-11-16 22:47:30 +01:00
parent 6507764545
commit a718f1e122

View File

@ -420,14 +420,14 @@ MapData::Attr MapData::pointAttr(const ISO8211::Record &r, uint OBJL)
uint key = av.at(0).toUInt(); uint key = av.at(0).toUInt();
if (key == OBJNAM) if (key == OBJNAM)
label = av.at(1).toString(); label = QString::fromLatin1(av.at(1).toByteArray());
if ((OBJL == HRBFAC && key == CATHAF) if ((OBJL == HRBFAC && key == CATHAF)
|| (OBJL == LNDMRK && key == CATLMK) || (OBJL == LNDMRK && key == CATLMK)
|| (OBJL == WRECKS && key == CATWRK) || (OBJL == WRECKS && key == CATWRK)
|| (OBJL == MORFAC && key == CATMOR) || (OBJL == MORFAC && key == CATMOR)
|| (OBJL == UWTROC && key == WATLEV) || (OBJL == UWTROC && key == WATLEV)
|| (OBJL == BUAARE && key == CATBUA)) || (OBJL == BUAARE && key == CATBUA))
subtype = av.at(1).toString().toUInt(); subtype = av.at(1).toByteArray().toUInt();
} }
return Attr(subtype, label); return Attr(subtype, label);
@ -447,12 +447,12 @@ MapData::Attr MapData::lineAttr(const ISO8211::Record &r, uint OBJL)
uint key = av.at(0).toUInt(); uint key = av.at(0).toUInt();
if (key == OBJNAM) if (key == OBJNAM)
label = av.at(1).toString(); label = QString::fromLatin1(av.at(1).toByteArray());
if ((OBJL == DEPCNT && key == VALDCO) if ((OBJL == DEPCNT && key == VALDCO)
|| (OBJL == LNDELV && key == ELEVAT)) || (OBJL == LNDELV && key == ELEVAT))
label = av.at(1).toString(); label = QString::fromLatin1(av.at(1).toByteArray());
if (OBJL == RECTRC && key == CATTRK) if (OBJL == RECTRC && key == CATTRK)
subtype = av.at(1).toString().toUInt(); subtype = av.at(1).toByteArray().toUInt();
} }
return Attr(subtype, label); return Attr(subtype, label);
@ -472,15 +472,15 @@ MapData::Attr MapData::polyAttr(const ISO8211::Record &r, uint OBJL)
uint key = av.at(0).toUInt(); uint key = av.at(0).toUInt();
if (OBJL == DEPARE && key == DRVAL1) if (OBJL == DEPARE && key == DRVAL1)
subtype = depthLevel(av.at(1).toString()); subtype = depthLevel(av.at(1).toByteArray());
else if ((OBJL == RESARE && key == CATREA) else if ((OBJL == RESARE && key == CATREA)
|| (OBJL == ACHARE && key == CATACH)) || (OBJL == ACHARE && key == CATACH))
subtype = av.at(1).toString().toUInt(); subtype = av.at(1).toByteArray().toUInt();
else if (OBJL == RESARE && key == RESTRN) { else if (OBJL == RESARE && key == RESTRN) {
if (av.at(1).toString().toUInt() == 1) if (av.at(1).toByteArray().toUInt() == 1)
subtype = 2; subtype = 2;
} else if (OBJL == TSSLPT && key == ORIENT) { } else if (OBJL == TSSLPT && key == ORIENT) {
double angle = av.at(1).toString().toDouble(); double angle = av.at(1).toByteArray().toDouble();
subtype = (uint)(angle * 10); subtype = (uint)(angle * 10);
} }
} }