1

Trying to use ogr2ogr to import a shapefile in PostgreSQL. Here is my command:

cd C:\Program Files (x86)\FWTools2.4.7\bin &&SET PGCLIENTENCODING= Windows-1256 &&ogr2ogr -f "PostgreSQL" -a_srs "EPSG:32639" PG:"host=localhost port=5432 dbname=123q user=postgres password=123456" "C:\Users\Desktop\GDB\test.mdb"

displays Persian text as a question mark , but when set PGCLIENTENCODING to UTF8 I catch this error

invalid byte sequence for encoding "UTF8": 0x9d

Vince
  • 20,017
  • 15
  • 45
  • 64
sep7696
  • 121
  • 5
  • 1
    First you should have a try with newer GDAL. The last FWTools is very very old. However, that may not fix the problem with character encoding. Writing a .cpg file to tell what character encoding the shapefile is using should work https://gis.stackexchange.com/questions/3529/which-character-encoding-is-used-by-the-dbf-file-in-shapefiles. – user30184 Apr 22 '21 at 06:11
  • Thanks and the problem is due to unicode windows server 2016 – sep7696 Apr 22 '21 at 10:30
  • isn't there a gotcha in the command because of the space between = and Windows-1256? – Jan Nov 26 '22 at 08:56

1 Answers1

1

To fix this problem, check "Beta: Use Unicode utf8 for worldwide language support " box in control panel ->region, administrator ->, language fornon unicode, which unfortunately does not exist in older Windows updates.

sep7696
  • 121
  • 5