Patrick Doyle
11/5/2008 12:48:00 PM
[Note: parts of this message were removed to make it a legal post.]
This won't help much, but when I executed:
>
> ASCII = (0..255).map{|c| c.chr }
> PRINTABLE = ASCII.grep(/[[:print:]]/)
> PRINTABLE.length
> >>> 191
>
in irb, I got 95 on my ruby 1.8.6 (i386-mswin32) running on an XP box.
What were the 191 characters displayed when computed the PRINTABLE
expression?
As a totally random theory, I wonder if [[:print:]] might take into account
what device is attached to stdout and recognize that your terminal is
capable of and use that to decide what is printable or not.
It would be quite surprising (and, perhaps unfortunate), if that's what's
going on, but it might explain what you saw.
A slightly more plausible explanation might be that [[:print:]] alters its
behavior based on the TERM environment variable. What is ENV["TERM"] in the
two cases?
That's all I've got. I warned you at the beginning that this wouldn't help
much.
--wpd