Skip to content

Commit 94a976c

Browse files
committedMay 5, 2013
Merge pull request #578 from minorua/fieldname_encoding
write field names in the same encoding as attribute values (fix #4540)
2 parents 945bc60 + 788e429 commit 94a976c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed
 

‎src/providers/ogr/qgsogrprovider.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -913,7 +913,7 @@ bool QgsOgrProvider::addAttributes( const QList<QgsField> &attributes )
913913
continue;
914914
}
915915

916-
OGRFieldDefnH fielddefn = OGR_Fld_Create( TO8( iter->name() ), type );
916+
OGRFieldDefnH fielddefn = OGR_Fld_Create( mEncoding->fromUnicode( iter->name() ).constData(), type );
917917
OGR_Fld_SetWidth( fielddefn, iter->length() );
918918
OGR_Fld_SetPrecision( fielddefn, iter->precision() );
919919

@@ -1893,7 +1893,7 @@ QGISEXTERN bool createEmptyDataSource( const QString &uri,
18931893
if ( precision < 0 )
18941894
precision = 3;
18951895

1896-
field = OGR_Fld_Create( TO8( it->first ), OFTReal );
1896+
field = OGR_Fld_Create( codec->fromUnicode( it->first ).constData(), OFTReal );
18971897
OGR_Fld_SetWidth( field, width );
18981898
OGR_Fld_SetPrecision( field, precision );
18991899
}
@@ -1902,7 +1902,7 @@ QGISEXTERN bool createEmptyDataSource( const QString &uri,
19021902
if ( width < 0 || width > 10 )
19031903
width = 10;
19041904

1905-
field = OGR_Fld_Create( TO8( it->first ), OFTInteger );
1905+
field = OGR_Fld_Create( codec->fromUnicode( it->first ).constData(), OFTInteger );
19061906
// limit to 10. otherwise OGR sets it to 11 and recognizes as OFTDouble later
19071907
OGR_Fld_SetWidth( field, width );
19081908
}
@@ -1911,16 +1911,16 @@ QGISEXTERN bool createEmptyDataSource( const QString &uri,
19111911
if ( width < 0 || width > 255 )
19121912
width = 255;
19131913

1914-
field = OGR_Fld_Create( TO8( it->first ), OFTString );
1914+
field = OGR_Fld_Create( codec->fromUnicode( it->first ).constData(), OFTString );
19151915
OGR_Fld_SetWidth( field, width );
19161916
}
19171917
else if ( fields[0] == "Date" )
19181918
{
1919-
field = OGR_Fld_Create( TO8( it->first ), OFTDate );
1919+
field = OGR_Fld_Create( codec->fromUnicode( it->first ).constData(), OFTDate );
19201920
}
19211921
else if ( fields[0] == "DateTime" )
19221922
{
1923-
field = OGR_Fld_Create( TO8( it->first ), OFTDateTime );
1923+
field = OGR_Fld_Create( codec->fromUnicode( it->first ).constData(), OFTDateTime );
19241924
}
19251925
else
19261926
{

0 commit comments

Comments
 (0)
Please sign in to comment.