Changes between Version 1 and Version 2 of rfc30_utf8_filenames


Ignore:
Timestamp:
Sep 1, 2010, 4:40:49 PM (14 years ago)
Author:
warmerdam
Comment:

update notes on python.

Legend:

Unmodified
Added
Removed
Modified
  • rfc30_utf8_filenames

    v1 v2  
    5656== Python Changes ==
    5757
    58 Review whether we should have some GDAL/OGR Python functions (ie. gdal.ReadDir()) return a unicode string instead of a byte string, and see if gdal.Open() and related should handle unicode strings as input intelligently if they don't already.
     58I observe with Python 2.6 that functions like gdal.Open() do not accept unicode strings, but they do accept utf-8 string objects.   One possible solution is to update the bindings in selective places to identify unicode strings passed in, and transform them to utf-8 strings.
     59
     60eg.
     61
     62{{{
     63filename =  u'xx\u4E2D\u6587.\u4E2D\u6587'
     64if type(filename) == type(u'a'):
     65    filename = filename.encode('utf-8')
     66}}}
     67
     68I'm not sure what the easiest way is to accomplish this in the bindings.  The key entries are:
     69
     70 * gdal.Open()
     71 * ogr.Open()
     72 * gdal.ReadDir()
     73 * gdal.PushFinderLocation()
     74 * gdal.FindFile()
     75 * gdal.Unlink()
     76
     77Note that failure to address these would only be an inconvenience requiring the applications to do the utf-8 conversion themselves.
     78
     79In theory functions that return filenames, such as gdal.ReadDir() should return unicode strings for filenames, but from my perspective it seems adequate to always return utf-8 strings and let the application translate if needed.
     80
     81== Java / C# / perl Changes ==
     82
     83I am not familiar enough with these environments to know if any changes are desirable to support unicode filenames more smoothly.
    5984
    6085== Utilities ==