Fix OGR2OGR Import – invalid byte sequence for encoding UTF8

Table of Contents

Fix OGR2OGR Import - invalid byte sequence for encoding UTF8

Error showing

When I use OGR2OGR to import Shapeilfe to PostgreSQL, I got error like this:

invalid byte sequence for encoding "UTF8": 0xe2 0x6e 0x20

How to fix invalid byte sequence for encoding UTF8

I run this command first

SET PGCLIENTENCODING=LATIN1

My full command to import Shapefile to PostgreSQL

set path=C:/OSGeo4W/bin/

SET PGCLIENTENCODING=LATIN1

ogr2ogr -f "PostgreSQL" PG:"host=localhost user=postgres dbname=**** password=**** port=**** schemas=import_data" D:\WebData\nongnghiepvungtau\file_system\map_upload\soi1301202235231pm_t3.shp -skipfailures -overwrite -nln import_data.map_upload -lco ENCODING=UTF-8

Leave a Reply

Your email address will not be published. Required fields are marked *