[gdal-dev] Re: Different result from GML with .xsd and .gfs

Jukka Rahkonen jukka.rahkonen at mmmtike.fi
Sun Jan 22 07:18:03 EST 2012

Even Rouault <even.rouault <at> mines-paris.org> writes:

> Yes, this is due to the XML mini parser directly integrated to GDAL that is 
> used to parse the .xsd. It doesn't understand the XML encoding header, so 
> assumes the content to be always utf-8.
> As suggested by someone in a previous related bost, you'd better use iconv 
> instead of editing the files.
> 1) ogr2ogr -f GML testi.gml m_asalue.tab
> 2) iconv -f iso-8859-1 -t utf-8 < testi.gml > testi_utf8.gml
> 3) iconv -f iso-8859-1 -t utf-8 < testi.xsd > testi_utf8.xsd
> 4) ogr2ogr -f SQLite -dsco spatialite=yes -a_srs epsg:2392 test.sqlite 
> testi_utf8.gml

Perhaps worth mentioning this in the GML driver document? Now it gives a feeling
that encoding support is general for both .gml and .xsd.

Encoding issues
Expat library supports reading the following built-in encodings :


How about adding something like:
" However, the .xsd schema files are parsed with the integrated minidriver which
does not understand different XML encodings. It expects encoding to be always
utf-8. If attribute names in the schema file contains non-ascii characters it is
better to use external iconv utility and convert both the .gml and .xsd file
into utf-8 encoding first. "

-Jukka Rahkonen-

More information about the gdal-dev mailing list