[mapserver-users] GetFeatureInfo XML result is not encoded at all

Guillaume Sueur guillaume.sueur at neogeo-online.net
Fri Jun 27 14:47:19 EDT 2008


That's not so easy when you don't know the encoding of the data used. In 
a current project I have, people upload their data to be published via WMS.
Would it be a big deal to add conversion of the result on the fly ?

Thanks,

Guillaume

Daniel Morissette a écrit :
> What you observed is correct: the wms_encoding metadata is only used to 
> fill the encoding parameter of the <?xml ...> element in the GML 
> response header. The current version of MapServer doesn't make any 
> attempt of converting the encoding of the source data (if different) to 
> that encoding.
> 
> The simple solution is to use the same encoding for both the mapfile and 
> all your data, and then wms_encoding can be used to set the encoding 
> name in the header and everything should work smoothly.
> 
> Daniel
> 
> 
> SAEZ Laurent - CETE Méditerr./DI/ETER wrote:
>> Hi list,
>>
>> I have :
>>
>>     * mapserver 4.99,
>>     * a mapfile utf-8 encoded,
>>     * a mapinfo file create on windows (encoding cp1252).
>>
>> Extract of my mapfile (utf-8 encoded) :
>> "...
>> METADATA (of the map block)
>> ...
>>     WMS_ENCODING "UTF-8"
>> END
>> ...
>> METADATA (of my layer)
>>     WMS_TITLE "TRONCON_ROUTE par Classement_Administratif_Route"
>>     WMS_EXTENT "73114.958418 1622638.022606 1197702.049962 
>> 2676196.041411"
>>     gml_include_items 
>> "Id_Route120,Vocation,Nombre_Chaussees,Nombre_Voies,Ouverture,Acces,Reseau_Vert,Sens,Reseau_Europeen,Numero_Route,Classement_Administratif_Route,Longueur_Troncon" 
>>
>> gml_Nombre_Chaussees_alias "Nombre_Chaussées"
>> END
>> ...."
>>
>> I have to make WMS/GetFeatureInfo requests (with 
>> INFO_FORMAT=application/vnd.ogc.gml).
>> I've made several tests and it seems that :
>>
>>     * WMS_ENCODING doens't encode anything. It just puts the right
>>       header of the XML returned (example : <?xml version="1.0"
>>       encoding="UTF-8"?>)
>>     * the XML tags name are putted as they're coded in the mapfile
>>       (example : <Nombre_Chaussées>1 chauss�e</Nombre_Chaussées>),
>>     * the XML tags values are putted as they're coded in the data source
>>       (example : see above).
>>
>> So, if I change MWS_ENCODING to ISO-8859-1 (in my mapfile UTF-8 
>> encoded) the only thing that changes is the XML header : <?xml 
>> version="1.0" encoding="ISO-8859-1"?>
>> The tags names and values are not encoded in ISO-8859-1. They're like 
>> I've explain above.
>> If I try to read my ISO-8859-1 GetFeatureInfo XML with FireFox, it 
>> warns that the XML is not well formed
>> (in my case at the line : <Nombre_Chaussées>2 
>> chaussées</Nombre_Chaussées>).
>>
>> NB : I've tried with GML_ENCODING with the same results.
>>
>> If I want all working right I have to :
>>
>>    1. encode my mapfile into the same encoding than my data (it isn't
>>       very easy because I've mapinfo files in cp1252 and PostGIS data in
>>       utf-8),
>>    2. use WMS_ENCODING with ISO-8859-1 value (that is the default value).
>>
>> I wonder if I have all understood !
>> I would like that someone explains to me what I have not understood 
>> and/or what I'm doing wrong.
>>
>> Thanks for help
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> mapserver-users mailing list
>> mapserver-users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/mapserver-users
> 
> 

-- 
Guillaume SUEUR
Expert SIG et OpenSource
NEOGEO
46 RUE MATABIAU
31000 TOULOUSE
06 74 91 95 20
Site web : http://www.neogeo-online.net



More information about the mapserver-users mailing list