[Cartoweb-users] Display data in Chinese
oliver.christen at camptocamp.com
Tue Sep 23 05:31:09 EDT 2008
you mean on the map image generated by mapserver ?
mmm, if the string is encoded in utf8 or unicode it should be passed
correctly from Cartoweb to mapserver, as long as the font you specified in
the LABEL definition in the mapfile contains the corresponding characters.
be sure the ENCODING parameter is set correctly in the related outline layer
in your mapfile, especially if you use another encoding.
the mapoverlay plugin (used internal by the outline plugin) do not support
dynamic modification of the ENCODING value, so you must use the same
encoding for all the text you input.
if thats a problem, you must modify a bit the mapoverlay plugin to implement
the "encoding" parameter. let me know if you need more details about that.
> Thanks very much, I can now handle chinese characters in search and
> However, for the outline plugin, how can I make it to display the labels
> Oliver Christen wrote:
>> Cartoweb can, by default, handle string encoded in UTF-8 and ISO-8859-1.
>> If the string are encoded using another encoding, for example BIG-5 (
>> for chinese characters ), you will need to use php's Multibyte String
>> Functions (http://ch2.php.net/mbstring) to convert the string in utf8 (or
>> ISO-8859-1). See the mb_convert_encoding functions for more details
>> So, the first step would be to know which encoding is used for the
>> Once you know that, you can easily add some tableRules
>> and also see the tutorial, point 9
>> http://www.cartoweb.org/cwiki/Foss4g06Workshops) to convert the encoding
>> using the above-mentioned mb_convert_encoding function.
>> This will do for query result table.
>> For tooltips, you need to extend the toolTips plugin (as explained in the
>> documentations) and apply the same encoding converstion on the result.
>> This is optional:
>> If you want to do it cleanly, you can create a new encoding/decoding
>> based on the existing encoding/decoding system. Simply look in
>> /common/Encoding.php and you will see the existing "class EncoderUTF
>> implements EncoderInterface" and "class EncoderISO implements
>> EncoderInterface". If needed, simply make your own "class EncoderXYZ
>> implements EncoderInterface" with the appropriate encode/decode function.
>> Create a new plugin and put your code inside (I think that should be
>> to be able to call the class). Define a new encoder id in your client.ini
>> (for example EncoderClass.xyz = EncoderXYZ). Then you can simply use
>> Encoder::decode($text, 'xyz') when you want to handle the chinese
>> I dont know any details about php's Multibyte String Functions so you
>> have to ask php's support if you need more help with that part.
>>> Dear all,
>>> I am using Cartoweb3.4 and in my shapefiles, some of the attribute data
>>> in Chinese. I would like to know how can I display these Chinese
>>> in Cartoweb? Like in the query result table and tooltips, etc. Right
>>> strange symbols are displayed instead.
>>> Thank you very much in advance for any help.
>>> Best regards,
>>> View this message in context:
>>> Sent from the cartoweb-users mailing list archive at Nabble.com.
>>> Cartoweb-users mailing list
>>> Cartoweb-users at lists.maptools.org
>> Cartoweb-users mailing list
>> Cartoweb-users at lists.maptools.org
> View this message in context:
> Sent from the cartoweb-users mailing list archive at Nabble.com.
> Cartoweb-users mailing list
> Cartoweb-users at lists.maptools.org
More information about the Cartoweb-users