Re: dealing with utf8 filenames

2006-02-22 Thread Brian J. Tarricone
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 2/22/2006 10:47 AM, Christian Neumair wrote: > Am Mittwoch, den 22.02.2006, 08:17 -0800 schrieb Alan M. Evans: >> On Wed, 2006-02-22 at 07:59, Christian Neumair wrote: >>> For the sake of readability, I'd rather use the following code: >>> >>> char

Re: dealing with utf8 filenames

2006-02-22 Thread Alan M. Evans
On Wed, 2006-02-22 at 10:47, Christian Neumair wrote: > > > 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) > > > > Surely

Re: dealing with utf8 filenames

2006-02-22 Thread Christian Neumair
Am Mittwoch, den 22.02.2006, 08:17 -0800 schrieb Alan M. Evans: > On Wed, 2006-02-22 at 07:59, Christian Neumair wrote: > > 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

Re: dealing with utf8 filenames

2006-02-22 Thread Alan M. Evans
On Wed, 2006-02-22 at 07:59, Christian Neumair wrote: > 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 o

Re: dealing with utf8 filenames

2006-02-22 Thread Christian Neumair
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 incorre

Re: dealing with utf8 filenames

2006-02-22 Thread 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 le

Re: dealing with utf8 filenames

2006-02-21 Thread Tor Lillqvist
Alan M. Evans writes: > This seems like an awful lot to go through just to get a filename > without an extension. Not really... > In particular, I'm unhappy with the amount of frivolous dynamic > allocation. Well, dynamic allocation is magnitudes faster than going to disk and reading the dir

dealing with utf8 filenames

2006-02-21 Thread Alan M. Evans
Suppose I have a filename returned from g_dir_read_name(). It's UTF-8, at least on Win32. I would like to determine if it has a particular extension (case insensitive) and display it without the extension. I can't believe that this manipulation is that uncommon, but the only solutions I've been ab