This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2013年01月27日 08:38 by nneonneo, last changed 2022年04月11日 14:57 by admin.
| Messages (4) | |||
|---|---|---|---|
| msg180748 - (view) | Author: Robert Xiao (nneonneo) * | Date: 2013年01月27日 08:38 | |
Try this at your command-prompt (requires utf8 support in the terminal emulator): $ python3 -m calendar -L zh_CN -e utf8 The result is a mess like this: 2013 一月 二月 三月 一 二 三 四 五 六 日 一 二 三 四 五 六 日 一 二 三 四 五 六 日 1 2 3 4 5 6 1 2 3 1 2 3 7 8 9 10 11 12 13 4 5 6 7 8 9 10 4 5 6 7 8 9 10 14 15 16 17 18 19 20 11 12 13 14 15 16 17 11 12 13 14 15 16 17 21 22 23 24 25 26 27 18 19 20 21 22 23 24 18 19 20 21 22 23 24 28 29 30 31 25 26 27 28 25 26 27 28 29 30 31 Note the irregular spacing. The calendar module assumes that the characters are half-width, when in reality they are full-width characters. calendar should use unicodedata.east_asian_width to determine if a character is full- or half-width, and adjust the spacing accordingly. |
|||
| msg180751 - (view) | Author: Robert Xiao (nneonneo) * | Date: 2013年01月27日 08:50 | |
This is also a problem in Python 2.7 after the patch in issue17049 is applied. |
|||
| msg181154 - (view) | Author: Terry J. Reedy (terry.reedy) * (Python committer) | Date: 2013年02月02日 09:41 | |
For this particular East Asian local, the problem is the double spacing between the double-width characters (the Chinese numbers 1 to 7). This is potentially easily fixed for this locale. But do all locales have abbreviated weekday names that fit in 2 columns? In looking at whether this issue should be classified as a bug or feature issue, I only found this: ''' class calendar.LocaleTextCalendar(firstweekday=0, locale=None) This subclass of TextCalendar can be passed a locale name in the constructor and will return month and weekday names in the specified locale.''' The current code does this, though not gracefully. I suspect that adding "-t html" to the command line, to use class calendar.LocaleHTMLCalendar, would work better. [Doc note 1: I suspect the next sentence "If this locale includes an encoding all strings containing month and weekday names will be returned as unicode.", which is unchanged from 2.x, is obsolete and perhaps should just be removed. Doc note 2: I could not find any doc for the command line interface in 8.2. calendar — General calendar-related functions. Unless I am missing something, a new section should be added.] #12568 will add a new feature that will only go in the 'next' release. So if this issue depends on that issue, it is effectively a new feature also. |
|||
| msg311001 - (view) | Author: Robert Booth (ishigoya) | Date: 2018年01月28日 21:30 | |
There is similar misaligned output in Japanese and Korean: Korean: 1월 2월 3월 월 화 수 목 금 토 일 월 화 수 목 금 토 일 월 화 수 목 금 토 일 1 2 3 4 5 6 7 1 2 3 4 1 2 3 4 8 9 10 11 12 13 14 5 6 7 8 9 10 11 5 6 7 8 9 10 11 Japanese: 1月 2月 3月 月 火 水 木 金 土 日 月 火 水 木 金 土 日 月 火 水 木 金 土 日 1 2 3 4 5 6 7 1 2 3 4 1 2 3 4 8 9 10 11 12 13 14 5 6 7 8 9 10 11 5 6 7 8 9 10 11 I came across this issue while using khal, a command-line calendar. That program also uses the calendar.LocaleTextCalendar class. I've raised an issue at https://github.com/pimutils/khal/issues/751 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:41 | admin | set | github: 61250 |
| 2018年01月29日 05:13:25 | chason.chaffin | set | nosy:
+ chason.chaffin |
| 2018年01月28日 21:30:28 | ishigoya | set | nosy:
+ ishigoya messages: + msg311001 |
| 2013年02月03日 04:38:26 | ezio.melotti | set | nosy:
+ ezio.melotti |
| 2013年02月02日 09:41:36 | terry.reedy | set | versions:
+ Python 3.4, - Python 2.7, Python 3.2 nosy: + rhettinger, terry.reedy messages: + msg181154 type: enhancement stage: needs patch |
| 2013年01月27日 09:01:24 | serhiy.storchaka | set | dependencies: + Add functions to get the width in columns of a character |
| 2013年01月27日 08:50:03 | nneonneo | set | messages:
+ msg180751 versions: + Python 2.7 |
| 2013年01月27日 08:38:10 | nneonneo | create | |