[gdal-dev] UTF-8 problem with MSSQLSpatial and ogr2ogr

philippe.suray philippe.suray at market-ip.com
Fri Mar 30 02:44:15 EDT 2012


Hello,

I am trying to load a shape file encoded in UTF-8 in SQLServer2008.
I use this command from ogr2ogr to load the data's:

ogr2ogr --debug on -f MSSQLSpatial
"MSSQL:server=localhost;database=ogr2ogrTest;Trusted_Connection=True;"
"myShapeFile.shp" -t_srs EPSG:4326 -dsco ENCODING=UTF-8 -lco ENCODING=UTF-8
-overwrite -progress

When I check the records in the DB, some fields are not correctly encoded.

According to SQLServer documentation and to my understanding: in order to
store unicode, the fields must be declared as NCHAR or NVARCHAR and the
insert or update statements must append 'N' before the value (INSERT INTO
tForeignLanguage ([Name]) VALUES (N'Араб'))

I also search about unicode in this list and found:
- http://osgeo-org.1560.n6.nabble.com/RFC-23-OGR-Unicode-td3759338.html
- http://trac.osgeo.org/gdal/wiki/rfc23_ogr_unicode

I downloaded the latest source code from http://www.gdal.org/daily/ and
check into mssqlspatial component and found that the driver does not respect
these assumptions:
- fields are created as VARCHAR,
- statements does not append 'N'

I really need this unicode support but I am not very familiar with C++,
could you help me to implement a patch to test the loading of a shapefile
into SQLServer2008.
What classes should I change and how?

Thank you for your help.

Best regards.

Philippe 

--
View this message in context: http://osgeo-org.1560.n6.nabble.com/UTF-8-problem-with-MSSQLSpatial-and-ogr2ogr-tp4670214p4670214.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.


More information about the gdal-dev mailing list