[gdal-dev] GDAL/OGR C# wrapper and UTF8

Dennis Gocke dengo at gmx.net
Wed Apr 3 14:38:20 PDT 2013


Hi Frank,

it’s nice to hear that the intention/plan is to have a consistent encoding
for all strings.

When I did my own C# wraps of the C API to circumvent the problem with the
current C# wrapper I did some experimenting.
Although you wouldn't normally have any non ASCII characters in WKT strings
(SpatialReferences) it seems OSR has problems when using UTF8 encoding.
Problem with Proj4 library?

That's why I stuck with ANSI for all OSR related strings.

Another thing I found was CPLSetConfigOption. Although you might use it to
set the directory paths (i.e. Plugins) it only works when using ANSI
encoding. It somehow knows that config options are supposed to be ANSI
encoded and will reencode them to UTF8 right before using them as
file/folder paths. Also that means having the plugins in a folder with
non-ANSI characters will not work, because you can not specify it
via CPLSetConfigOption.

Greetings,
Dennis


On Wed, Apr 3, 2013 at 11:07 PM, Frank Warmerdam <warmerdam at pobox.com>wrote:

>
>
>
> On Wed, Apr 3, 2013 at 12:54 PM, Tamas Szekeres <szekerest at gmail.com>wrote:
>
>> Frank,
>>
>> We seem to consider only a subset of the parameters (filenames and
>> fileds) that should be utf8 encoded. But it seems that's not enough. For
>> example treating fields as utf8 would also require to modify
>> SetAttibuteFilter to provide match with the same value returned from
>> GetFieldAsString. In this regard that would be more sufficient to treat all
>> strings as being utf8 in GDAL. With regards to C# that would mean to
>> convert all strings between Unicode and UTF8.
>>
>>
> Tamas,
>
> I agree that the argument to SetAttributeFilter() should also be
> considered UTF8.
>
> I can't, off hand, think of any strings that should not be considered to
> be UTF8.
>
> 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
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20130403/d41af832/attachment-0001.html>


More information about the gdal-dev mailing list