From: "David A. Black" Date: 2010-07-17T21:03:22+09:00 Subject: Different results in command-line vs. TextMate ---993115281-49588556-1279368197=:17825 Content-Type: MULTIPART/MIXED; BOUNDARY="-993115281-49588556-1279368197=:17825" This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. ---993115281-49588556-1279368197=:17825 Content-Type: TEXT/PLAIN; format=flowed; charset=ISO-8859-15 Content-Transfer-Encoding: 8BIT Hi -- I was working on an answer to James Rasmussen's question, and discovered the following somewhat puzzling (to me) thing. James's text file has some non-printing (Word-derived?) characters, instead of regular spaces: >> text = File.read("lines.txt") => "Clark\302\240\302\240\302\240\302\240\302\240\302\240Kent\302\240\302\240\r\nPop\302\240Eye\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\r\n" >> puts text Clark������Kent�� Pop�Eye�������������� What's odd is that when I try to scan these lines, I get different results depending on whether I'm on the command line or in TextMate. From the command line: $ cat parse.rb lines = File.readlines("lines.txt") p RUBY_DESCRIPTION p lines.map {|line| line.scan(/\w+/) } $ ruby parse.rb "ruby 1.8.7 (2008-05-31 patchlevel 0) [i686-darwin9.8.0]" [["Clark", "Kent", "super", "fakeplace", "com"], ["Pop", "Eye", "popeye", "fakeplace", "com"]] And from TextMate, using command-r: "ruby 1.8.7 (2008-05-31 patchlevel 0) [i686-darwin9.8.0]" [["Clark Kent ", "super", "fakeplace", "com", " "], ["Pop Eye ", "popeye", "fakeplace", "com", " "]] As you can see, it's not just the display that's different. The scan operation actually produced different results. It feels like some kind of Heisenbug but I can't puzzle it out. David -- David A. Black, Senior Developer, Cyrus Innovation Inc. The Ruby training with Black/Brown/McAnally Compleat Philadelphia, PA, October 1-2, 2010 Rubyist http://www.compleatrubyist.com ---993115281-49588556-1279368197=:17825-- ---993115281-49588556-1279368197=:17825--