When importing a shapefile (in this case a public census tract shapefile) into SQL Server 2016 using ogr2ogr, the string fields are set to a single special character. The geography and integer fields import without issue.

The first import will be ʳ, the second will be ǿ, a new character each time I overwrite. The mssql field creates with the nvarchar(x) datatype and the appropriate length that matches the shape fields. I've also tried a .vrt file with specifics, but same thing happens.

ogr2ogr -overwrite -f "MSSQLSpatial" "MSSQL:Driver={SQL Server Native Client 11.0};server=(local);database=Spatial;trusted_connection=yes" tl_2010_06_zcta510.shp

Same unanswered issue here - Encoding issue with ogr2ogr and SQL Server

This happens on all shapefiles I try to import, no matter the source. String fields turn into single special characters when loaded. I am using the most recent GDAL 2.1.3, but have also tried the dev 2.2.0.

The data appears when querying "Results to Text", but has the special single char like in the snippet below.


3 Answers 3


It could be an issue with GDAL 2.x.x since I have exactly the same encoding issue while importing shapefile using GDAL 2.2.1 But when I use the same command line and GDAL 1.11.3 text is imported in a proper way. This way for me the solution was to roll back to GDAL 1.x.x


I solved that issue installing the latest update of GDAL (2.2.3). My previous version was 2.2.0.


Same issue here. I found How did QGIS fix a shapefile's character encoding, and can I do this on the command line with ogr2ogr? and fixed the problem by adding --config SHAPE_ENCODING "ISO-8859-1" to the ogr2ogr command.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.