(chinese) unicode labeling with postgis db

Mario Basa mario.basa at GMAIL.COM
Sun Feb 18 09:17:47 EST 2007


Hi Chris,

I am just guessing here, but did you do a

\enconding gb18030

when you were importing the data into the database? I think there was
no encoding translation done, so the data is still in gb18030 format
even if it is in a UTF-8 databse.

mario.


2007/2/16, Christian Sengstock <csengstock at gmail.com>:
> Hi,
> actually its working exact the way its described in the docs.
>
> @mario: nice way to test these isuses, think i'll use that from now on.
>
> what i missed to add was:
>
> LABEL
>   ..
>   ENCODING GB18030
> END
> (i wrote that i tested this already but unfortunatley it seems that i didnt,
> sorry)
>
> However i dont really understand why its that way because:
>
> 1.) I imported the data from GB18030 (ascii) into the UNICODE postgres
> database (actually its saved as UNICODE)
> 2.) use truetype and a UNICODE font in mapserver (postgis connection)
>
> I'm a  bit confused that i have to set the GB18030 encoding now in the
> mapserver LABEL section, because the data in the db is already UNICODE !?
>
> Maybe someone knows about that,
> Chris
>
>
>
> On Thu, 15 Feb 2007 00:13:18 +0900, Mario Basa <mario.basa at GMAIL.COM> wrote:
>
> >Hello Christian,
> >
> >What I usually do if I have label encoding problems (w/c happens a lot
> >with japanese characters) is to create an annotation layer with an
> >inline feature and then test using different fonts or encoding
> >parameters. Something like this:
> >
> >LAYER
> >    NAME "Label Test"
> >    STATUS DEFAULT
> >
> >    TRANSFORM FALSE
> >
> >    TYPE ANNOTATION
> >    FEATURE
> >      POINTS 420 420 END
> >      TEXT " Japanese_Characters_go_here "
> >    END
> >
> >    CLASS
> >      LABEL
> >        TYPE TRUETYPE
> >        ENCODING SJIS
> >        FONT pgothic
> >        SIZE 10
> >        COLOR 255 255 255
> >        BACKGROUNDCOLOR 0 0 255
> >      END
> >    END
> >  END
> >
> >Also, the ENCODING parameter translates the label into UTF-8,  so if
> >the label is in UTF-8 already, ENCODING shouldn't be necessary
> >anymore.
> >
> >Regards,
> >
> >Mario.
> >
> >2007/2/14, Christian Sengstock <csengstock at gmail.com>:
> >> Hi list,
> >> i try to do labeling for chinese features but have some problems.
> >> I tried to make it the way i found in some docs in the internet and in
> >> the mail archive:
> >>
> >> - use a postgis unicode db
> >> - use unicode truetype fonts
> >>
> >> But unfourtunately its not working for now.
> >>
> >>
> >> I use a postgres/postgis dbms (PostgreSQL 8.0.9  POSTGIS 1.0.6) and
> >> mapserver 4.10.0 (ms4w package).
> >>
> >> My database is UNICODE encoded (imported with GB18030 client encoding).
> >> The unicode chars seem to be ok, i can use these chinese strings in my
> >> web application and they work.
> >>
> >> I have a point layer which i render with UMN mapserver.
> >> Now i tried to render the points like this...
> >>
> >> LAYER
> >>   NAME 'poi'
> >>   TYPE POINT
> >>   CONNECTIONTYPE postgis
> >>   CONNECTION '...'
> >>   DATA 'geom FROM geo.poi'
> >>   METADATA
> >>     'wms_title' 'poi'
> >>   END
> >>   STATUS ON
> >>   TRANSPARENCY 100
> >>   PROJECTION
> >>   'proj=longlat'
> >>    'ellps=WGS84'
> >>    'datum=WGS84'
> >>    'no_defs'
> >>   END
> >>   LABELITEM 'name'
> >>   CLASS
> >>      NAME poi
> >>      STYLE
> >>         SYMBOL 'circle'
> >>         SIZE 3
> >>         COLOR 255 150 150
> >>      END
> >>      LABEL
> >>        ANTIALIAS true
> >>        COLOR 255 255 255
> >>        OUTLINECOLOR 0 0 0
> >>        POSITION CC
> >>        OFFSET 0 2
> >>        BUFFER 2
> >>        TYPE TRUETYPE
> >>        FONT 'arialuni'
> >>        ANGLE auto
> >>        SIZE 8
> >>        #ENCODING UTF-8 | UNICODE ???
> >>     END
> >>   END
> >> END
> >>
> >> where font 'arialuni' ist the microsoft arial unicode font:
> >> arialuni ARIALUNI.TTF
> >>
> >> If i use ENCODING UNICODE, its no labels at all.
> >> If i use ENCODING UTF-8 (or GB18030), its like i have no ENCODING attribute.
> >>
> >> Attached is a screenshot from the map.
> >>
> >>
> >> Maybe someone can help or can point me to a good doc?
> >> Thanx a lot,
> >> Chris
> >>
> >>
>



More information about the mapserver-users mailing list