[gdal-dev] RFC 30: Unicode Filenames - call for discussion
Frank Warmerdam
warmerdam at pobox.com
Tue Sep 21 15:49:33 EDT 2010
Tamas Szekeres wrote:
> Frank,
>
> How do we know whether an unicode on an ansi string mapping should be
> actually done in the bindings? With respect to the C# bindings the
> strings are normally maintained as unicode in the C# side however the
> default conversion option is "Charset.Ansi" in the interface causing the
> character conversion is done automatically. When marshaling the
> stringlist values a custom code in typemaps_csharp.i use
> System.Runtime.InteropServices.Marshal.PtrToStringAnsi explicitly.
>
> All of this mapping could also be set to unicode as well, however it's
> not clear to me how to decide whether ansi or unicode mapping should
> actually be done. Or do we intend to create 2 versions of each functions
> enumerated in RFC 30? Recall to switch between the unicode and ansi
> versions of the WinAPI functions (like CreatefileW or CreateFileA) are
> normally selected 'globally' by using a compiler flag.
Tamas,
The intention of the RFC is that all filenames will be treated as utf-8.
You mention a Changeset.Ansi converter. I assume it is also possible to
do a unicode to utf-8 conversion at the swig interface? It sounds like
all strings that are supposed to be utf-8 as opposed to "locale dependent
C strings" should be identified and a different typemap used for them.
Does that make sense? I have made some note of this in the RFC but I'm
not in a great position to fool with the C# bindings so I'm hoping you
will help with them.
I'll note that all the OGR string and stringlist field reading and writing
should also be handled as if the strings are utf-8 per RFC 23. Is that
done currently?
http://trac.osgeo.org/gdal/wiki/rfc23_ogr_unicode
It would be nice if there is some resilience in the face of filenames
coming back that are not valid utf-8. I think if the CPL conversion
functions are used this will come "for free".
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