[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-gnulib] Re: ISSLASH on Woe32

From: Ian Abbott
Subject: [bug-gnulib] Re: ISSLASH on Woe32
Date: Thu, 28 Apr 2005 18:36:27 +0100
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

On 28/04/2005 15:56, Bruno Haible wrote:
      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: <address@hidden>        )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587         )=-

reply via email to

[Prev in Thread] Current Thread [Next in Thread]