7

Similar to another question I posted previously, I'm trying to import datasets from Esri geodatabases into a PostGIS database directly, and inside the data, there are greek letters and symbols that are not converting correctly. I tried using FWTools on Windows with a command like this:

ogr2ogr -f "PostgreSQL" PG:"host=server.domain.com user=gisuser dbname=gis"
dataset.mdb LayerName -a_srs EPSG:4326

The first time I tried, I got this error from ogr2ogr:

ERROR 1: INSERT command for new feature failed.
ERROR: invalid byte sequence for encoding "UTF8": 0xb4
HINT: This error can also happen if the byte sequence does not match the
encoding expected by the server, which is controlled by "client_encoding".

I found out that setting a particular environment variable at the Windows command line can fix this issue:

SET PGCLIENTENCODING=LATIN1

That fixed importing problem -- all the records and geometry are in PostGIS, but as a result, the non-English characters are not encoded correctly. When I use UTF-8 or UTF8 for client encoding (not sure which is correct), I get the same invalid byte sequence error as above. Has anyone else had this problem or found a way around it? Is this an issue with the .mdb file itself, or is there something on the server I can change to globally correct this?

1
  • I haven't had exactly that error, but encodings can really be a pain sometimes :)
    – Chau
    Commented Sep 10, 2010 at 6:54

2 Answers 2

8

Greek isn't LATIN1, try

SET PGCLIENTENCODING=ISO_8859_7
1
1

some great looking documentation in this google search. convert latin to unicode

http://www.google.com/#sclient=psy&hl=en&site=&source=hp&q=convert+latin+to+unicode&aq=f&aqi=&aql=&oq=&gs_rfai=&psj=1&fp=9085ebf0eb5276e9

1
  • which google search?
    – underdark
    Commented Sep 12, 2010 at 15:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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