[Gdal-dev] Re: UTF-8 problem with ogr2ogr

Charlie Savage cfis at interserv.com
Sat Dec 10 17:51:30 EST 2005


What most likely is happening:

* Your postgresql database is in UTF8
* You are loading data from some other encoding, lets say Latin1, where 
the character is greater than 155.  For example, something like a tilde (~)
* OGR loads up the postgresql client libraries it is linked against
* The library code assumes utf8 and is not told otherwise by ogr2ogr
* The ~ character is not valid in utf8 because in utf8 it occupies more 
than one btye
* You get an error message.

Unfortunately, ogr2ogr does not support encodings at all and thus there 
isn't much you can do.  I think you may be able to influence the 
encoding the postgresql client library assumes by fiddling with 
environmental variables or the locale settings on Linux.  You'll have to 
check the postgresql documenation to see.   Alternatively, recompile 
ogr2ogr and add in a call to the postgresql client library telling it 
the encoding of the source dataset.

For ogr2ogr support for encodings you'll have to lobby Frank.

Charlie


Sorokine, Alexandre wrote:
> Hello!
>  
> I was trying to convert an ESRI .mdb into PostgreSQL/PostGIS with 
> ogr2ogr (from FWTools 1.0.0a7 on Windows).  However, I've got the 
> following error:
>  
> ERROR: Invalid UTF-8 byte sequence detected near byte 0xb0
>  
> As far as I understand this problem is related to character encoding.  I 
> wonder if anybody knows what can be done about that?
>  
> --
> Alex Sorokine, Ph.D. <sorokina at ornl.gov <mailto:sorokina at ornl.gov>>
> Oak Ridge National Laboratory
> tel. (865) 576-7597 fax. (865) 241-6261
>  
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Gdal-dev mailing list
> Gdal-dev at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/gdal-dev





More information about the Gdal-dev mailing list