[PATCH v2] Improve the width of alternate representation for year in strftime [BZ #23758]

Paul Eggert eggert@cs.ucla.edu
Sun Oct 28 22:52:00 GMT 2018


TAMUKI Shoichi wrote:
> Since only one Japanese era name is used by each emperor's reign, it
> is rare that the year ends in one digit or lasts more than three
> digits.

Rare recently, but over the long term about 75% of Japanese imperial years have 
been single-digit years: since 701 AD there have been 989 single-digit years but 
only 329 two-digit years. (This calculation is approximate, but it's close 
enough; see attached shell script for how I did the calculation.) Although Japan 
is more stable now than it was centuries ago, the long reigns since 1868 are a 
historical aberration and it should not be surprising if the fraction of 
single-digit years reverts closer to historical levels in the not-too-distant 
future.

Although I'm no expert in Japanese, as I understand it the most common style for 
formatting imperial dates in plain text uses no spaces anywhere, e.g., "平成2年3 
月4日" for Heisei 2 March 4. It's far less common to see spaces to make things 
line up, presumably for tables.

Since glibc is already defaulting to space padding for month and day-of-month, 
it makes sense for glibc to also default to space padding for imperial year. 
However, this change should be announced more clearly. The ChangeLog entry 
should say what's going on at a high level, and give an example call to strftime 
with the before-and-after output, along with how to generate imperial dates with 
no spaces; and (more important) the glibc documentation should for strftime 
should contain similar examples.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: era.sh
Type: application/x-shellscript
Size: 1542 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20181028/b6a8d81f/attachment.bin>


More information about the Libc-alpha mailing list