In article <49a25ec0ce233_84c7e8c1f8909a / redmine.ruby-lang.org>,
  Charles Nutter <redmine / ruby-lang.org> writes:

> Bug #1195: String#% does not include prefix before zero value for # versions of numeric formats

It's intentional.

> Ruby 1.9.1p0:
>
>  $ ruby1.9 -e "p('%#b %#B %#o %#x %#X' % [0,0,0,0,0])"
>  "0 0 0 0 0"

GNU/Linux, NetBSD, FreeBSD, OpenBSD, Mac OS X and Solaris
works as Ruby 1.9.

% cat tst.c
#include <stdio.h>

int main(int argc, char *argv[])
{
  printf("%#o %#x %#X\n", 0, 0, 0);
  return 0;
}
% gcc -Wall tst.c
% ./a.out
0 0 0

Perl also works as Ruby 1.9.

% perl -e 'printf "%#o %#x %#X\n", 0, 0, 0'
0 0 0
% perl -v

This is perl, v5.8.8 built for i486-linux-gnu-thread-multi
...
-- 
Tanaka Akira