[gdal-dev] Proposed UTF-8 SWIG Changes

Frank Warmerdam warmerdam at pobox.com
Mon Sep 27 11:35:42 EDT 2010


Tamas Szekeres wrote:
> 
> 2010/9/27 Frank Warmerdam <warmerdam at pobox.com <mailto:warmerdam at pobox.com>>
> 
>     Even, Tamas, Ari, Howard, and other SWIG wise men,
> 
>     I got lost last night in the SWIG typemaps we use for GDAL, but
>     eventually
>     I came up with a minimal patch that seems to make sense and work.  I
>     would
>     appreciate it if you guys could skim it and let me know if I'm doing
>     things
>     in a really wrong or dangerous way.
> 
>      http://trac.osgeo.org/gdal/attachment/ticket/3766/utf8_swig.patch
> 
>     I am attempting to treat any const char * parameter named utf8_path via
>     a custom typemap that uses the preexisting GDALPythonObjectToCStr() to
>     convert it.  This appears to take regular strings, and unicode strings
>     properly in Python.
> 
> 
> Frank,
> 
> I don't really undestand what's wrong with this. Applying custom 
> typemaps to specific parameters is widely used in the bindings. Those 
> languages will get a warning if that typemap is not yet implemented 
> which is a correct way to notify there should something to be done for 
> that language.


Tamas,

Well, I don't know if there is anything wrong with my approach.

I am depending on the parameter name (utf8_path) to trigger the typemap
and presumably for languages not implementing that typemap the normal
"const char *" typemaps will kick in so I don't anticipate any errors
for the other bindings.  But I also haven't tried them.

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 Programmer for Rent



More information about the gdal-dev mailing list