UTF8 PostGIS tables and labelitem

Alessandro Pasotti ale.pas at TISCALI.IT
Sat Nov 11 04:56:47 PST 2006


Hello,

I have a mapfile UTF8 encoded wich reads data from an UTF8 PostGIS table (note 
the NON ASCII labelitem "varietà":



#---------- start layer vig_camp_2004----------
LAYER
  NAME   "vig_camp_2004"
  CONNECTION   "host=localhost user=*** password=*** port=5433 
dbname=database"
  CONNECTIONTYPE  postgis
  TYPE  POINT
  DATA   "the_geom from vig_camp_2004"
  LABELITEM   "varietà"
  TEMPLATE   "ttt"
  STATUS   default

  CLASS
   NAME  "punti di campionamento"
   COLOR   255 255 64
   OUTLINECOLOR   0 0 0
   SIZE  15
   SYMBOL  "star"

   LABEL
    ANTIALIAS  true
    COLOR  255 255 64
    FONT  "arial"
    OUTLINECOLOR  192 0 0
    POSITION  ul
    SIZE  7
    TYPE  truetype
   END
  END

  PROJECTION
         "init=epsg:3003"
  END

  METADATA
   DESCRIPTION  "Campionamenti 2004"
   RESULT_FIELDS        "proprietar,varietà"
   LAYER_ENCODING       "UTF-8"
   QUERY_BY_POINT       "ttt"
   ATTRIBUTE_SEARCH     "1"
   WMS_SRS  "epsg:3003"
   WMS_TITLE  "vig_camp_2004"
   WMS_FEATURE_INFO_MIME_TYPE  "text/html"
  END
END

-----
This is the error:
msDrawMap(): Image handling error. Failed to draw layer named 'vig_camp_2004'.
prepare_database(): Query error. Error executing POSTGIS DECLARE (the actual 
query) statement: 'DECLARE mycursor BINARY CURSOR FOR SELECT 
varietà::text,asbinary(force_collection(force_2d(the_geom)),'NDR'),gid::text 
from vig_camp_2004 WHERE the_geom && setSRID('BOX3D(1490836.03506098 
4967565.5,1541436.33993902 4995227)'::BOX3D, 
find_srid('','vig_camp_2004','the_geom') )'

Postgresql reports the error as 'ERROR: column "variet�" does not exist '

------

Note that the same DB and the same mapfile works fine on my local ubuntu 
dapper (which is more UTF8 ready) but fails on my producion server which is 
Debian based (and more LATIN9 oriented)

I tried to set default client encoding to UTF8 on the server but it did'nt 
help.

It's clearly something to do with mapserver passing the query with the wrong 
encoding or postgres not recognising it correctly.

Any hint would be highly appreciated.


--- further info ----

# /usr/lib/cgi-bin/mapserv -v
MapServer version 4.8.3 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP 
OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=FREETYPE SUPPORTS=WMS_SERVER 
SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT 
SUPPORTS=WCS_SERVER SUPPORTS=THREADS SUPPORTS=GEOS INPUT=EPPL7 INPUT=POSTGIS 
INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE DEBUG=MSDEBUG

# cat /etc/debian_version
testing/unstable

# file /mapfiles/mapfile.map
/mapfiles/mapfile.map: UTF-8 Unicode text

# psql -l
        List of databases
   Name    |  Owner   | Encoding
-----------+----------+----------
 database  | postgres | UTF8

-- 
Alessandro Pasotti
itOpen - "Open Solutions for the Net Age"
w3:  www.itopen.it
Linux User# 167502



More information about the MapServer-users mailing list