strftime %b is broken on ja_JP locale

Kazuhiro Fujieda fujieda@acm.org
Fri May 14 04:35:00 GMT 2010


>>> On Wed, 12 May 2010 17:31:18 +0200
>>> Corinna Vinschen <corinna-cygwin@cygwin.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@acm.org

2010-05-14  Kazuhiro Fujieda  <fujieda@acm.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



More information about the Cygwin mailing list