Skip to content

Commit f3f2d3f

Browse files
committed
MWGIS-238; apply UTF-8 encoding to labels in DynamicLoading is enabled
1 parent f810e0f commit f3f2d3f

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

src/Ogr/Ogr2RawData.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,10 @@ void Ogr2RawData::FieldsToShapeRecord(OGRFeatureDefn* poFields, OGRFeature* poFe
137137
}
138138
else //if (type == OFTString )
139139
{
140+
// string should be interpreted as UTF-8 unless overridden in Global Settings
141+
CStringW ws = OgrHelper::OgrString2Unicode(poFeature->GetFieldAsString(iFld));
140142
var->vt = VT_BSTR;
141-
var->bstrVal = A2BSTR(poFeature->GetFieldAsString(iFld)); // BSTR will be cleared by CComVariant destructor
143+
var->bstrVal = W2BSTR(ws); // BSTR will be cleared by CComVariant destructor
142144
}
143145
data->Row->values.push_back(var);
144146
}

src/Ogr/Ogr2Shape.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,8 @@ void Ogr2Shape::CopyValues(OGRFeatureDefn* poFields, OGRFeature* poFeature, ISha
439439
{
440440
// preview string
441441
// NOTE that it is presumed that ALL strings coming from OGR can be interpreted as UTF-8
442-
CStringW str = Utility::ConvertFromUtf8(poFeature->GetFieldAsString(iFld));
442+
// and the following function will account for the Global Setting override to ANSI
443+
CStringW str = OgrHelper::OgrString2Unicode(poFeature->GetFieldAsString(iFld));
443444
// OGR does not currently support the Logical (boolean) field type. It is possible that they will exist
444445
// in the file, but OGR will interpret them as Strings. Since we support boolean field types, we want
445446
// to have a way of copying these particular string fields and interpreting them as booleans. We will

0 commit comments

Comments
 (0)