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. |
| 58 | I 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 | |
| 60 | eg. |
| 61 | |
| 62 | {{{ |
| 63 | filename = u'xx\u4E2D\u6587.\u4E2D\u6587' |
| 64 | if type(filename) == type(u'a'): |
| 65 | filename = filename.encode('utf-8') |
| 66 | }}} |
| 67 | |
| 68 | I'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 | |
| 77 | Note that failure to address these would only be an inconvenience requiring the applications to do the utf-8 conversion themselves. |
| 78 | |
| 79 | In 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 | |
| 83 | I am not familiar enough with these environments to know if any changes are desirable to support unicode filenames more smoothly. |