[Featureserver] type=OGR & encoding problem

Christopher Schmidt crschmidt at metacarta.com
Wed Aug 5 14:17:11 EDT 2009


On Wed, Aug 05, 2009 at 02:02:56PM -0400, Alexandre Dube wrote:
> Hi,
> 
>   I have some .tab files I'd like serve with featureserver.  Their 
> encoding is iso-8859-1 and they do contain special characters such as 
> French accents.  If I use type=OGR in the .cfg file to serve the data, I 
> get the following error :
> 
>   An error occurred: 'utf8' codec can't decode byte 0xb0 in position 2: 
> unexpected code byte
> 
>   I looked in the code source and it doesn't seem to support other 
> character encodings than utf8.  Is this right ?  Or is this a known bug 
> ?  Any workaround ?

Not a bug, just a lack of functionality.

     if isinstance(value, str): value = unicode(value, "utf-8")

Change that line to iso-8859-1, and ou should be good. If youd like to make
it configurable and send a patch, all the better.

>   If I import this file in PostGIS (with ogr2ogr + shp2pgsql (while 
> specifying iso-8859-1 as character encoding)) and use type=PostGIS 
> instead to link to this new imported data, I get no error, but I get 
> weird characters (lots of '\' and numbers instead of my special 
> character in the geojson string returned).  BUT, in the end, the special 
> characters get displayed correctly in the application (OpenLayers) so 
> it's ok.  This could be a good workaround, but I'd like to avoid the 
> transfer of each file I have in PostGIS if possible...
> 
>   Any hint ?
> 
>   Many thanks,
> 
> -- 
> Alexandre Dubé
> Mapgears
> www.mapgears.com
> 
> _______________________________________________
> Featureserver mailing list
> Featureserver at openlayers.org
> http://featureserver.org/mailman/listinfo/featureserver

-- 
Christopher Schmidt
MetaCarta



More information about the Featureserver mailing list