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

Dennis Gocke dengo at gmx.net
Wed Apr 3 02:13:22 PDT 2013


Tamas,
If you don't mind me asking, what exactly is your plan?
Are you planning to just fix the methods related to setting and getting of feature string attributes or are you planning to use UTF8 encoding for other methods too?

This is a very delicate problem, because if we assume that an unmanaged string is UTF8 encoded but is actually ANSI encoded and use Encoding.UTF8.GetString() information might actually be lost that can not be recovered retroactively by calling Encoding.Default.GetString(Encoding.UTF8.GetBytes(str)).
This is not the case for the other way around when assuming ANSI encoding when it is actually UTF8 encoded where Encoding.UTF8.GetString(Encoding.Default.GetBytes(str)) will recover the correct string.

I think it would be very desirable, if GDAL/OGR in general would use a consistent string encoding internally for all methods or at least provide information about when which encoding is used if that's at all possible.

Best regards,
Dennis


More information about the gdal-dev mailing list