@@ -913,7 +913,7 @@ bool QgsOgrProvider::addAttributes( const QList<QgsField> &attributes )
913
913
continue ;
914
914
}
915
915
916
- OGRFieldDefnH fielddefn = OGR_Fld_Create ( TO8 ( iter->name () ), type );
916
+ OGRFieldDefnH fielddefn = OGR_Fld_Create ( mEncoding -> fromUnicode ( iter->name () ). constData ( ), type );
917
917
OGR_Fld_SetWidth ( fielddefn, iter->length () );
918
918
OGR_Fld_SetPrecision ( fielddefn, iter->precision () );
919
919
@@ -1893,7 +1893,7 @@ QGISEXTERN bool createEmptyDataSource( const QString &uri,
1893
1893
if ( precision < 0 )
1894
1894
precision = 3 ;
1895
1895
1896
- field = OGR_Fld_Create ( TO8 ( it->first ), OFTReal );
1896
+ field = OGR_Fld_Create ( codec-> fromUnicode ( it->first ). constData ( ), OFTReal );
1897
1897
OGR_Fld_SetWidth ( field, width );
1898
1898
OGR_Fld_SetPrecision ( field, precision );
1899
1899
}
@@ -1902,7 +1902,7 @@ QGISEXTERN bool createEmptyDataSource( const QString &uri,
1902
1902
if ( width < 0 || width > 10 )
1903
1903
width = 10 ;
1904
1904
1905
- field = OGR_Fld_Create ( TO8 ( it->first ), OFTInteger );
1905
+ field = OGR_Fld_Create ( codec-> fromUnicode ( it->first ). constData ( ), OFTInteger );
1906
1906
// limit to 10. otherwise OGR sets it to 11 and recognizes as OFTDouble later
1907
1907
OGR_Fld_SetWidth ( field, width );
1908
1908
}
@@ -1911,16 +1911,16 @@ QGISEXTERN bool createEmptyDataSource( const QString &uri,
1911
1911
if ( width < 0 || width > 255 )
1912
1912
width = 255 ;
1913
1913
1914
- field = OGR_Fld_Create ( TO8 ( it->first ), OFTString );
1914
+ field = OGR_Fld_Create ( codec-> fromUnicode ( it->first ). constData ( ), OFTString );
1915
1915
OGR_Fld_SetWidth ( field, width );
1916
1916
}
1917
1917
else if ( fields[0 ] == " Date" )
1918
1918
{
1919
- field = OGR_Fld_Create ( TO8 ( it->first ), OFTDate );
1919
+ field = OGR_Fld_Create ( codec-> fromUnicode ( it->first ). constData ( ), OFTDate );
1920
1920
}
1921
1921
else if ( fields[0 ] == " DateTime" )
1922
1922
{
1923
- field = OGR_Fld_Create ( TO8 ( it->first ), OFTDateTime );
1923
+ field = OGR_Fld_Create ( codec-> fromUnicode ( it->first ). constData ( ), OFTDateTime );
1924
1924
}
1925
1925
else
1926
1926
{
0 commit comments