summaryrefslogtreecommitdiffstats
path: root/winsup
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2010-05-26 11:36:17 +0000
committerCorinna Vinschen <corinna@vinschen.de>2010-05-26 11:36:17 +0000
commita36728eae0d15b993073ad298e5ca4469936d20a (patch)
tree2214d1bfa0ae5c9916e1ffaa267b376fe583c669 /winsup
parent0b3906a8137e9b9b9e81ffdb0da1b7ddb8131335 (diff)
downloadcygnal-a36728eae0d15b993073ad298e5ca4469936d20a.tar.gz
cygnal-a36728eae0d15b993073ad298e5ca4469936d20a.tar.bz2
cygnal-a36728eae0d15b993073ad298e5ca4469936d20a.zip
* 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')
-rw-r--r--winsup/cygwin/ChangeLog9
-rw-r--r--winsup/cygwin/nlsfuncs.cc14
2 files changed, 20 insertions, 3 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index cbf2a0e45..1e274ff2a 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,4 +1,11 @@
-2010-05-18 Kazuhiro Fujida <fujieda@acm.org>
+2010-05-26 Kazuhiro Fujieda <fujieda@acm.org>
+ Corinna Vinschen <corinna@vinschen.de>
+
+ * 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.
+
+2010-05-18 Kazuhiro Fujieda <fujieda@acm.org>
* environ.cc (regopt): Change the first argument to wide char string.
(environ_init): Accommodate change to the first argument of regopt.
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 */