working with database in UTF-8

Stephen Woodbridge woodbri at SWOODBRIDGE.COM
Fri Jun 22 11:45:46 PDT 2007


Jackey,

I suspect that the font file is not utf8 or the data is already mangled 
before it gets to mapserver. The mapserver stuff works fine for me with 
utf-8 data in shapefiles as long as I set the ENCODING 'utf8' in the 
LABEL. A bigger issue might be:

What is the encoding on the source data?
what is the encoding on the database?
was the data loded correct with respect to the encoding?
if you do a select * from table in mysql does the data display correctly?
if you slect the records with ogrinfo? to a file or you monitor do they 
show corectly?

There are a WHOLE lot oof steps where things could have broken before it 
gets to mapserver. You need to validate the data is still good as it 
comes into mapserver.

-Steve W.

Steve Lime wrote:
> Hmmm... All the encoding parameter does is tell MapServer to convert from the supplied encoding to
> unicode so I don't think it has any effect. If you already have unicode/utf-8 strings then this should
> just work assuming your font has the right characters.
> 
> Does a simple shapefile work?
> 
> Steve
> 
>>>> On 6/22/2007 at 2:56 AM, in message
> <bfb704a40706220056t20220029n82b4ec43aa5e3854 at mail.gmail.com>, Jackey Cheung
> <cheung.jackey at GMAIL.COM> wrote:
>> Greetings!
>>
>> I'm trying to setup a mapserver that supports multiple languages with MySQL.
>> The database uses UTF-8, while the map server use a select statement to
>> retrieve records. The layer goes as:
>>
>>     LAYER
>>         NAME                        sr
>>         STATUS                    OFF
>>
>>         TYPE                        POINT
>>         CONNECTIONTYPE    OGR
>>         CONNECTION            "<OGRVRTDataSource>
>>                                             <OGRVRTLayer name='sr'>
>>
>> <SrcDataSource>MYSQL:MapSQL,user=root,password=123456,host=localhost,port=3306
>> ,tables=POI</SrcDataSource>
>>                                                 <SrcSQL>SELECT `Name`, geom
>> FROM `POI` WHERE `ID` = %o%</SrcSQL>
>>
>> <GeometryType>wkbPoint</GeometryType>
>>                                             </OGRVRTLayer>
>>                                          </OGRVRTDataSource>"
>>         DATA                        "sr"
>>         UNITS                        METERS
>>
>>         MAXFEATURES            1
>>         LABELITEM                "Name"
>>
>>         CLASS
>>             SYMBOL                    "point"
>>             MINSIZE                    10
>>             COLOR                        250    0    0
>>             OUTLINECOLOR        0    128    0
>>
>>             LABEL
>>                 ENCODING            "utf-8"
>>                 COLOR                    255    0    0
>>                 OUTLINECOLOR    255    255    255
>>                 TYPE                    TRUETYPE
>>                 FONT                    arial
>>                 SIZE                    8
>>                 ANTIALIAS            TRUE
>>                 POSITION            UC
>>                 PARTIALS            FALSE
>>                 BUFFER                5
>>                 FORCE                    TRUE
>>             END
>>         END
>>     END
>>
>> All Chinese characters are shown as question marks (?) on the map, no mater
>> using arial or Chinese fonts.
>>
>> Any advise?



More information about the MapServer-users mailing list