[Top][All Lists]

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

RE: [Bug-gnubg] probable fixes for catalog and gtkfile things

From: macherius
Subject: RE: [Bug-gnubg] probable fixes for catalog and gtkfile things
Date: Wed, 23 Feb 2005 12:35:50 +0100

>From the config.h I stole from Jon:

#define strcasecmp stricmp
#define strncasecmp strnicmp

which is defined like this:

string.h:_CRTIMP int __cdecl _stricmp(const char *, const char *);
string.h:_CRTIMP int __cdecl stricmp(const char *, const char *);

The reason behind (my guess) is similar that the reason why glib does
provide it's own strcasecmp function family.


The problem with g_strncasecmp() is that it does the comparison by calling
toupper()/tolower(). These functions are locale-specific and operate on
single bytes. However, it is impossible to handle things correctly from an
I18N standpoint by operating on bytes, since characters may be multibyte.
Thus g_strncasecmp() is broken if your string is guaranteed to be ASCII,
since it's locale-sensitive, and it's broken if your string is localized,
since it doesn't work on many encodings at all, including UTF-8, EUC-JP,


> -----Original Message-----
> From: address@hidden [mailto:address@hidden 
> Sent: Wednesday, February 23, 2005 12:11 PM
> To: address@hidden
> Cc: macherius; address@hidden
> Subject: Re: [Bug-gnubg] probable fixes for catalog and gtkfile things
> On Wed, 23 Feb 2005 08:59:57 +0100, Jim Segrave wrote:
> > Just curious - where is strcasecmp() prototyped then?
> strcasecmp() doesn't exist on Windows (see 
> http://msdn.microsoft.com/library/default.asp?url=/library/en-
for an overview of available string routines). MinGW does provide it,
though. And it's found in string.h then.



reply via email to

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