fp = fopen (file_name, "r");
In approach (2) LIBDIR will be an UTF-8 encoded pathname. The ISSLASH operation will therefore work correctly. However, fopen() expects a string in locale encoding, not in UTF-8 encoding. Therefore we have to replace the last line with
char *real_file_name = u8_conv_to_locale (file_name); fp = fopen (real_file_name, "r"); free (real_file_name);
Or, alternatively, replace the whose set of libc functions dealing with pathnames with wrappers that take an UTF-8 string:
fp = u8_fopen (file_name, "r");
Whereas in approach (4), we can leave the code as it is.
GLib seems to have taken the alternative approach you suggested and uses wrappers around the stdio functions - g_fopen() instead of fopen(), etc. Their implementation uses the "wide character" API on NT-based Windows systems and the "8-bit character in current locale" API on DOS-based Windows systems. It looks like Tor Lillqvist is mostly responsible for this implementation.
-- -=( Ian Abbott @ MEV Ltd. E-mail: <[EMAIL PROTECTED]> )=- -=( Tel: +44 (0)161 477 1898 FAX: +44 (0)161 718 3587 )=-
_______________________________________________ bug-gnulib mailing list bug-gnulib@gnu.org http://lists.gnu.org/mailman/listinfo/bug-gnulib