public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Corinna Vinschen <vinschen@redhat.com>
To: gcc-patches@gcc.gnu.org, gdb-patches@sourceware.org
Subject: Re: [RFA/libiberty] Darwin has case-insensitive filesystems
Date: Wed, 15 Jun 2011 21:11:00 -0000	[thread overview]
Message-ID: <20110615194152.GC18126@calimero.vinschen.de> (raw)
In-Reply-To: <8362o79f9j.fsf@gnu.org>

On Jun 15 20:27, Eli Zaretskii wrote:
> > Date: Wed, 15 Jun 2011 10:22:36 +0200
> > From: Corinna Vinschen <...>
> > Talking about case-insensitive comparison, the filename_cmp and
> > filename_ncmp functions don't work for multibyte codesets, only for
> > singlebyte codesets.  Given that UTF-8 is standard nowadays, shouldn't
> > these functions be replaced with multibyte-aware versions?
> 
> I agree, but if we go that way, shouldn't we support UTF-16, which is
> used by the native Windows APIs?  Windows does not use UTF-8 for file
> names.

I don't think so.  UTF-16 is Windows' wchar_t (or WCHAR) codeset, but
the applications calling the libiberty functions are using the char
datatype with single- or multibyte codesets.

If the filename_cmp function converts the multibyte input strings
to wchar_t and compares the wide char strings case insensitive(*),
they would use UTF-16 under the hood on Windows anyway.  

(*) As proposed in
    http://sourceware.org/ml/gdb-patches/2011-06/msg00210.html,
    basically like this:

    #ifdef _WIN32
    #define wcscasecmp _wcsicmp
    #endif
    mbstowcs (wide_a, a);
    mbstowcs (wide_b, b);
    return wcscasecmp (wide_a, wide_b);


Corinna

-- 
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat

      reply	other threads:[~2011-06-15 19:42 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-14 21:57 Joel Brobecker
2011-06-14 22:02 ` DJ Delorie
2011-07-01 17:58   ` Joel Brobecker
2011-06-14 22:06 ` Andrew Pinski
2011-06-14 22:13   ` DJ Delorie
2011-06-15  4:25     ` Tristan Gingold
2011-06-15  8:14     ` Joel Brobecker
2011-06-15  9:30     ` Corinna Vinschen
2011-06-15 10:44       ` Mark Kettenis
2011-06-15 10:55         ` Corinna Vinschen
2011-06-15 11:00           ` Pedro Alves
2011-06-15 11:26         ` Robert Dewar
2011-06-15 17:47           ` Eli Zaretskii
2011-06-15 10:59       ` Joseph S. Myers
2011-06-15 11:07         ` Corinna Vinschen
2011-06-15 17:35       ` Eli Zaretskii
2011-06-15 21:11         ` Corinna Vinschen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110615194152.GC18126@calimero.vinschen.de \
    --to=vinschen@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).