[mapserver-users] OGR Virtual Format and character encoding

Frank Warmerdam warmerdam at pobox.com
Fri Aug 31 13:59:24 PDT 2012


On Fri, Aug 31, 2012 at 1:37 PM, Chris Jackson <webturtles at gmail.com> wrote:
> Frank
>
> I am using <SrcDataSource>ODBC:..... in the OVF file.  I am parsing the file
> using OGRinfo via commandline and the characters are looking odd straight
> away.

Chris,

I'm not convinced that command windows support UTF-8 output properly
so funny looking output from ogrinfo in a command window may not
be a conclusive indicator of whether the driver is returning UTF-8 or not.

Since you are going through ODBC I imagine the key to the translation
is in gdal/port/cpl_odbc.cpp.  In particular I see that SQL_WCHAR and
friends are translated as wide characters while SQL_CHAR is not.  I
am not clear on whether NVARCHAR fields in MS SQL are represented
as SQL_VARCHAR or SQL_WVARCHAR at the ODBC level of the code.

You might want to try changing:

        case SQL_CHAR:
        case SQL_VARCHAR:
        case SQL_LONGVARCHAR:
            return SQL_C_CHAR;

in the cpl_odbc.cpp GetTypeMapping() code to return
SQL_C_WCHAR instead and see if that helps.  You might
also want to put in a printf() in the SQL_WCHAR case to see
if it being used or not.

> Hadn't thought about using the spatial add-on for 2005, can that be
> called directly from the mapfile instead?  I usually just use shapefiles
> (performance surprising good), but have need of a SQL table of point data
> (all over Europe - hence the character issues) updated via a web-form to be
> called via MapServer and another application.  Any pointers appreciated!

I am not clear on the details of the MSSQLSpatial driver, but if you
aren't using the mssql spatial types then you might be just as well
to stick with ODBC.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Software Developer


More information about the mapserver-users mailing list