Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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?

share|improve this question
    
I haven't had exactly that error, but encodings can really be a pain sometimes :) –  Chau Sep 10 '10 at 6:54

2 Answers 2

up vote 6 down vote accepted

Greek isn't LATIN1, try

SET PGCLIENTENCODING=ISO_8859_7
share|improve this answer
3  
Oh, and in the "teach a man to fish" category, I found that answer here: postgresql.org/docs/8.4/static/multibyte.html –  Paul Ramsey Sep 10 '10 at 14:40

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

share|improve this answer
    
which google search? –  underdark Sep 12 '10 at 15:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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