[GIS] Can’t import shapefiles into SQL Server, because of Encoding issues

importshapefilesql server

I'm trying to import some shapefiles into SQL Server.

At first I had difficulty finding third party tools as I realized that Microsoft has not supported this out of the box. So I found Shape2Sql and Ogr2Ogr.
Then I realized that Shape2Sql is not under active development so that I had to replace some DLL files to make it work.
Then I imported some shapefiles from geonames.com.
Then I found better shapefiles in http://www.openstreetmap.org, downloaded from here
Then I tried to import them using Shaep2Sql, but encoding was not correct.

Then I tried with some different collations to see if the problem goes away or not, and no success.
Then I tried to import it using Ogr2Ogr (version 2.18), but it failed with memory failure error. I searched and found out that this is a reported bug and it's not solved yet.
Then I tried to download older version (before 2.0) and it didn't have ogr2ogr exe file.
enter image description here

And now I'm stuck, spending more than 2 days trying to make it work and the more I search the less I find.

Do we have other tools for importing shape files into SQL Server? Is it possible to do it via C# code through some library? I have no idea cause I'm new to GIS and I don't need much from GIS. Only bounding boxes for a bunch of cities. That's all I want.

Update: I also tried importing dbf files into Excel by simply opening them with Excel, and again Unicode characters are not shown properly:enter image description here

Best Answer

First you should find out the enconding of your database. This answer should help you find out.

As shape2sql does not have an option for encoding you should encode your shapefile according to your database encoding.

Or you can change the encoding of the database like mentioned in this answer.

If you want to change the encoding of your shapefile there are many ways to do so. You could use QGIS and save your layer with the new encoding. You also can use LibreOffice to save the .dbf in another encoding. The important thing is to have the correct encoding in the programs at first.