SV: [mapguide-users] Get Garbled in SelectionPanel (fusion)

Måns Beckman mans.beckman at manandmachine.se
Tue Jun 24 09:13:17 EDT 2008


Hi, 

I have had a quick look at this because I have the same problem with Swedish chars "ÅÄÖåäö". I didn't get the utf8_encode to work for me either, but I did see some interesting things in the JSON code.

Here is the output I get when I select one feature in the map.

{"layers":["Vägar-Text"],"extents":{"minx":93434.546699998,"miny":6217429.1614999,"maxx":102313.2338
,"maxy":6224177.9349999},"Vägar-Text":{"propertynames":["FeatId","GATUNAMN","VAGNR","ZOOMLEVEL"],"propertyvalues"
:["FeatId","GATUNAMN","vägnummer","ZOOMLEVEL"],"propertytypes":[7,9,9,9],"metadatanames":["dimension"
,"bbox","center","area","length"],"numelements":1,"values":[["1518","Christinelundsvägen
 (111)","111","level0"]],"metadata":[["","","","",""]]}}



What I think is really interesting is that:
The layers property is encoded correct - "layers":["Vägar-Text"]," 
The property values are encoded correct - "propertyvalues":["FeatId","GATUNAMN","vägnummer","ZOOMLEVEL"]
But the values are encoded wrong - "values":[["1518","Christinelundsvägen (111)","111","level0"]] should be "values":[["1518","Christinelundsvägen (111)","111","level0"]]



The same data displays OK in the Ajax-viewer so it's not the values that are wrong. I'm kind of guessing that the error is in the place where we get the values from, and should be corrected there, and not in Selection.php.

Best regards
Måns

-----Ursprungligt meddelande-----
Från: mapguide-users-bounces at lists.osgeo.org [mailto:mapguide-users-bounces at lists.osgeo.org] För Paul Spencer
Skickat: den 24 juni 2008 12:58
Till: MapGuide Users Mail List
Ämne: Re: [mapguide-users] Get Garbled in SelectionPanel (fusion)

Darn - ok, I just went and looked at what utf8_encode actually does  
(!) and its not what we want in this case, it encodes iso 8895-1  
characters as utf8 which is probably the generally useful case for  
most people but doesn't apply to double byte character sets.

I really don't understand character encoding at all, but I am willing  
to incorporate changes into fusion to make this work as long as it is  
generic enough to work in the common cases that I deal with too.   
Unfortunately I don't have the time to put into becoming educated  
about this right now ...

Can you spend some time looking into these functions (and the user  
comments that follow):

http://www.php.net/manual/en/function.utf8-encode.php
http://ca3.php.net/manual/en/book.iconv.php

and let us know what you find out?

Cheers

Paul

On 24-Jun-08, at 1:41 AM, D.Ootaka wrote:

>
> Thanks, Paul
>
> I tried to wrap the output in utf8_encode, but not good...
>
> 1. wrap $result
>
> Selection.php / Line 144
> echo utf8_encode(var2json($result));
>
> http://www.nabble.com/file/p18084122/utf8_encode_result.png
> utf8_encode_result.png
>
> 2. wrap property value
>
> Selection.php / Line 132
> for($k=0; $k<count($properties->$layerName->values[$j]); $k++){
>    $result->$layerName->values[$iIndice][$k] =
> utf8_encode($properties->$layerName->values[$j][$k]);
> }
>
> http://www.nabble.com/file/p18084122/utf8_encode_value.png
> utf8_encode_value.png
>
> Regards.
>
> Ootaka
>
>
> Paul Spencer-5 wrote:
>>
>> Um, I would expect that this is because the data coming from the
>> fusion backend is not being properly encoded.  This came up recently
>> on the list and the proposed solution was to wrap output of text in
>> the utf8_encode function.
>>
>> For the selection panel, this would probably be coming from mapguide/
>> php/Selection.php - if you modify this file to wrap the output in
>> utf8_encode and it works, please let us know.
>>
>> Cheers
>>
>> Paul
>>
>
> -- 
> View this message in context: http://www.nabble.com/Get-Garbled-in-SelectionPanel-%28fusion%29-tp18064719p18084122.html
> Sent from the MapGuide Users mailing list archive at Nabble.com.
>
> _______________________________________________
> mapguide-users mailing list
> mapguide-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users

_______________________________________________
mapguide-users mailing list
mapguide-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users


More information about the mapguide-users mailing list