ogr2ogr encoding on Windows using os4geo shell with Census data
There is.
If on windows simply run:
set PGCLIENTENCODING=LATIN1
In the command line before running your ogr2ogr command.
If your on Linux, you need to run:
export PGCLIENTENCODING=LATIN1;
Unfortunately it cannot be done with GDAL, you will have to set the PGCLIENTENCODING environment variable to LATIN1 in your operating system instead.
(e.g. in windows it can be done under System--> Advanced system settings--> Environment variables -->New system variable)
The GDAL documentation on PostgreSQL driver mentions this issue:
"By default it is assumed that text being sent to Postgres is in the UTF-8 encoding. This is fine for plain ASCII, but can result in errors for extended characters (ASCII 155+, LATIN1, etc).
While OGR provides no direct control over this, you can set the PGCLIENTENCODING environment variable to indicate the format being provided. For instance, if your text is LATIN1 you could set the environment variable to LATIN1 before using OGR and input would be assumed to be LATIN1 instead of UTF-8. An alternate way of setting the client encoding is to issue the following SQL command with ExecuteSQL() : "SET client_encoding TO encoding_name" where encoding_name is LATIN1, etc."