X-Recipient: archive-cygwin@delorie.com
X-Spam-Check-By: sourceware.org
Date: Thu, 21 Jan 2010 17:03:09 +0100
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: Japanese/Chinese language question
Message-ID: <20100121160309.GA8726@calimero.vinschen.de>
Reply-To: cygwin@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
References: <20100121134055.GE2402@calimero.vinschen.de>  <f60fe001001210704o27f08b15lcb3456fb59822024@mail.gmail.com>  <20100121154120.GF2402@calimero.vinschen.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20100121154120.GF2402@calimero.vinschen.de>
User-Agent: Mutt/1.5.20 (2009-06-14)
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com

On Jan 21 16:41, Corinna Vinschen wrote:
> On Jan 21 10:04, Mark J. Reed wrote:
[Intersting stuff]
> 
> Thanks for the info.  However...
> 
> 
>   linux$ cat jp.c
>   #include <stdio.h>
>   #include <locale.h>
>   #include <wchar.h>
> 
>   int
>   main (int argc, char **argv)
>   {
>     setlocale (LC_ALL, "ja_JP.UTF-8");
>     /* U+3042 = Hiragana letter A
>        U+30a2 = Katakana letter A
>        U+ff71 = Halfwidth Katakana letter A */
>     printf ("%d\n", wcscoll (L"\x3042", L"\x30a2"));
>     printf ("%d\n", wcscoll (L"\xff71", L"\x30a2"));
>     return 0;
>   }
>   linux$ gcc jp.c -o jp
>   linux$ ./jp
>   -83
>   -340
> 
> I expected that at least one of the comparisons returns 0.
> Am I doing something wrong?

Uh, I think I understand now.  I wasn't actually doing something wrong,
rather my expectations were wrong.  The idea of the coll/xfrm functions
is to generate sorting orders.  The order as such is locale-dependent,
but different strings shouldn't actually being treated as equal.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

