Re: dealing with utf8 filenames



Am Mittwoch, den 22.02.2006, 07:09 -0800 schrieb Alan M. Evans:
On Tue, 2006-02-21 at 16:25, Tor Lillqvist wrote:
 > Also, I don't think the string returned from g_utf8_casefold() is
 > guaranteed to be the same length as the original, so my calculation
 > for string length is incorrect.

Umm, no? You look at the casefolded string and calculate the length of
the part up to the '.' of that?

Yes, that's what I'm doing. No, I don't think it's correct.

You can perfectly do pointer arithmetic with UTF-8 encoded strings.

For the sake of readability, I'd rather use the following code:

char **str;

/* str[0]: basename
   str[1]: extension */
str = g_strsplit (filename, ".", 2);

g_strfreev(str)

-- 
Christian Neumair <chris gnome-de org>


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