2010.02.08 12:37 "[Tiff] Libtiff and UTF-8 filename support", by Graeme Gill

2010.02.08 12:37 "[Tiff] Libtiff and UTF-8 filename support", by Graeme Gill

I was looking though the libtiff V4.0.0beta5 sources, and noticed that there is probably a discrepancy between the behavior of Libtiff between MSWindows and Unix like platforms with regard to filename encoding.

On Unix like systems (tif_unix.c) TIFFOpen calls the open() with a possibly UTF-8 filename, while in tif_win32.c it calls CreateFileA(), which doesn't take a UTF-8 argument.

This means that in otherwise platform independent software, there needs to be some ugly code above libtiff to handle these two cases

Wouldn't it be better to make TIFFOpen support UTF-8 on both Unix and MSWindows, by making tif_win32.c do a MultiByteToWideChar() and then use CreateFileW()? (or would this create problems in code that expects there to be differences between the platforms ?)

[TIFFOpenW() could remain for those who have platform
  specific code at that level.]

Graeme Gill.