Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2010-05-26 15:36:17 +0400
committerCorinna Vinschen <corinna@vinschen.de>2010-05-26 15:36:17 +0400
commita36728eae0d15b993073ad298e5ca4469936d20a (patch)
tree2214d1bfa0ae5c9916e1ffaa267b376fe583c669 /winsup/cygwin/nlsfuncs.cc
parent0b3906a8137e9b9b9e81ffdb0da1b7ddb8131335 (diff)
* nlsfuncs.cc (__set_lc_time_from_win): Use LOCALE_SMONTHNAME1
instead of LOCALE_SABBREVMONTHNAME1 in Japanese and Korean locales to get abbreviated month names. Explain why.
Diffstat (limited to 'winsup/cygwin/nlsfuncs.cc')
-rw-r--r--winsup/cygwin/nlsfuncs.cc14
1 files changed, 12 insertions, 2 deletions
diff --git a/winsup/cygwin/nlsfuncs.cc b/winsup/cygwin/nlsfuncs.cc
index b4afa2306..e67814747 100644
--- a/winsup/cygwin/nlsfuncs.cc
+++ b/winsup/cygwin/nlsfuncs.cc
@@ -551,10 +551,20 @@ __set_lc_time_from_win (const char *name,
sizeof *lc_era, locale_cmp);
/* mon */
+ /* Windows has a bug in Japanese and Korean locales. In these
+ locales, strings returned for LOCALE_SABBREVMONTHNAME* are missing
+ the suffix representing a month. Unfortunately this is not
+ documented in English. A Japanese article describing the problem
+ is http://msdn.microsoft.com/ja-jp/library/cc422084.aspx
+ The workaround is to use LOCALE_SMONTHNAME* in these locales,
+ even for the abbreviated month name. */
+ const LCTYPE mon_base =
+ lcid == MAKELANGID (LANG_JAPANESE, SUBLANG_JAPANESE_JAPAN)
+ || lcid == MAKELANGID (LANG_KOREAN, SUBLANG_KOREAN)
+ ? LOCALE_SMONTHNAME1 : LOCALE_SABBREVMONTHNAME1;
for (int i = 0; i < 12; ++i)
{
- _time_locale->wmon[i] = getlocaleinfo (time,
- LOCALE_SABBREVMONTHNAME1 + i);
+ _time_locale->wmon[i] = getlocaleinfo (time, mon_base + i);
_time_locale->mon[i] = charfromwchar (time, wmon[i]);
}
/* month and alt_month */