[Bug 839] cal produces garbled week-day names when locale is Japan or Taiwan

bugzilla at busybox.net bugzilla at busybox.net
Sat Jan 16 10:54:24 UTC 2010


https://bugs.busybox.net/show_bug.cgi?id=839





--- Comment #3 from kuo <cookie at ms93.url.com.tw>  2010-01-16 10:54:22 UTC ---
Dear Sir,
     I am sorry for my reply being late.
     The unicode chars are twice as wide as ASCII chars.
     By the way, there are many GPL TTFs containing Chinese chars.  For
example, FireFly TTF
(http://cle.linux.org.tw/fonts/FireFly/fireflysung-1.3.0.tar.gz) is one of
them.

(In reply to comment #2)
> I see this:
> 
> # LANG=zh_TW.utf8 cal
>       一月 2010     
> 日 一 二 三 四 五 六
>                 1  2
>  3  4  5  6  7  8  9
> 10 11 12 13 14 15 16
> 17 18 19 20 21 22 23
> 24 25 26 27 28 29 30
> 31
> 
> What do you see with "standard" cal?
> 
> My machine does not have right fonts to shot those glyphs, so I have a
> question: do week day names take 2 char positions per hieroglyph?
> 
> The responsible code in cal.c is:
> 
>         i = 0;
>         do {
>                 zero_tm.tm_mon = i;
>                 /* full month name according to locale */
>                 strftime(buf, sizeof(buf), "%B", &zero_tm);
>                 month_names[i] = xstrdup(buf);
> 
>                 if (i < 7) {
>                         zero_tm.tm_wday = i;
>                         /* abbreviated weekday name according to locale */
>                         strftime(buf, sizeof(buf), "%a", &zero_tm);
> ====>===BAD======>      strncpy(day_headings + i * (3+julian) + julian, buf,
> 2);
>                 }
>         } while (++i < 12);
> 
> Arrow indicates code which simply remembers 2 BYTES from every weekday name.
> That's much.
> 
> Just converting it to take two *unicode chars* instead would be not so hard,
> but I need to know whether these unicode chars (in this case more like
> hieroglyphs) are twice as wide and ACSII chars? If yes, we'd need the code to
> account for this.
> 


-- 
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


More information about the busybox-cvs mailing list