delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/05/13/21:55:23

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=0.9 required=5.0 tests=BAYES_40,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SARE_SUB_PCT_LETTER,TW_MW,T_TO_NO_BRKTS_FREEMAIL
X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
Subject: Re: strftime %b is broken on ja_JP locale
References: <AANLkTim2nxVJS5qleVkgBAsTxXGEaKNdRz4-3l9Tbavj AT mail DOT gmail DOT com> <20100512153117 DOT GB25439 AT calimero DOT vinschen DOT de>
From: Kazuhiro Fujieda <fujieda AT acm DOT org>
In-Reply-To: <20100512153117.GB25439@calimero.vinschen.de> (Corinna Vinschen's message of "Wed\, 12 May 2010 17\:31\:18 +0200")
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.3 (windows-nt)
Date: Fri, 14 May 2010 10:55:01 +0900
Message-ID: <u39xvw8lm.fsf@acm.org>
MIME-Version: 1.0
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

>>> On Wed, 12 May 2010 17:31:18 +0200
>>> Corinna Vinschen <corinna-cygwin AT cygwin DOT com> said:

> No, that's not broken, even if it seems so.  Cygwin fetches the
> localized strings from the underlying OS, not from a Cygwin-specific
> locale database.  What you see as results above is what *Windows*
> returns for the full and abbreviated month strings.

Windows has a bug in Japanese and Korean locales. In these
locales, strings reterned by GetLocaleInfoW for
LOCALE_SABBREVMONTHNAME* miss suffixes representing a month.

It should return "5\u6708" in Japanese and "5\c6d4" in
Korea. MSDN in Japanese describes so. It, however, returns "5"
in both locales. In Chenese, it returns "\u4e94\6708" with the
suffix.

We can solve this problem with LOCALE_SMONTHNAME* instead of
LOCALE_SABBREVMONTHNAME* in these locales. I attathed the patch.
-- 
Kazuhiro Fujieda
fujieda AT acm DOT org

2010-05-14  Kazuhiro Fujieda  <fujieda AT acm DOT org>

	* nlsfuncs.cc (__set_lc_time_from_win): Use LOCALE_SMONTHNAME1
	instead of LOCALE_SABBREVMONTHNAME1 in Japanese and Korean
	locales to get abbreviated month names.

Index: nlsfuncs.cc
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/nlsfuncs.cc,v
retrieving revision 1.31
diff -u -r1.31 nlsfuncs.cc
--- nlsfuncs.cc	28 Apr 2010 10:00:24 -0000	1.31
+++ nlsfuncs.cc	14 May 2010 01:45:05 -0000
@@ -554,7 +554,11 @@
       for (int i = 0; i < 12; ++i)
 	{
 	  _time_locale->wmon[i] = getlocaleinfo (time,
-						 LOCALE_SABBREVMONTHNAME1 + i);
+						 ((lcid == 0x0411 ||
+						   lcid == 0x0412)
+						   ? LOCALE_SMONTHNAME1
+						   : LOCALE_SABBREVMONTHNAME1)
+						   + i);
 	  _time_locale->mon[i] = charfromwchar (time, wmon[i]);
 	}
       /* month and alt_month */

--
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019