From: Patrick Doyle Date: 2008-11-05T21:48:16+09:00 Subject: Re: irb and ruby giving different results ------=_Part_4564_29657729.1225889398556 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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 ------=_Part_4564_29657729.1225889398556--