Re: [patch] symlink filename i18n





Alexander Larsson wrote:
On Mon, 2007-04-23 at 17:29 +0900, Takao Fujiwara - Tokyo S/W Center
wrote:

Sorry, I havn't get this.


I don't understand this. You say:

The updated patch means if G_BROKEN_FILENAMES is defined, we use
g_locale_to_utf8() instead of g_filename_to_utf8().

This means g_locale_to_utf8() doesn't use g_utf8_validate() internally and we expect it's not UTF-8 encoding.


What does this mean? Can you provide a little more detail. For your information, g_filename_to_utf8 does not use g_utf8_validate
internally.

OK, I mean:

g_filename_to_utf8() uses g_utf8_validate() internally below.

gchar*
g_filename_to_utf8 (const gchar *opsysstring,
                    gssize       len,
                    gsize       *bytes_read,
                    gsize       *bytes_written,
                    GError     **error)
{
  const gchar *charset;

  if (g_utf8_validate (opsysstring, -1, NULL))
     return strdup_len (opsysstring, len, bytes_read, bytes_written, error);
  if (get_filename_charset (&charset))
    return strdup_len (opsysstring, len, bytes_read, bytes_written, error);
  else
    return g_convert (opsysstring, len,
                      "UTF-8", charset, bytes_read, bytes_written, error);
}

But g_utf8_validate() returns TRUE for none UTF-8 string because the code point is duplicated between UTF-8 and the none UTF-8.
If we use G_BROKEN_FILENAMES, the current encoding is always retrieved by g_locale_charset().

When we use g_locale_to_utf8(), it does not check whether the string is already UTF-8 or not.




=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Alexander Larsson Red Hat, Inc alexl redhat com alla lysator liu se He's a war-weary zombie firefighter fleeing from a secret government programme. She's a manipulative red-headed widow in the witness protection program. They fight crime!





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