On Fri, May 16, 2008 at 4:10 PM, DJ Jazzy Linefeed <john.d.perkins / gmail.com> wrote: > def prep_file(path) > > ret = '' > > x = File.open(path) > > x.lines.each do |l| > l.gsub!('\n', ' ') > ret << l > end > > puts ret > > end > ... > compare.rb:64:in `gsub': broken UTF-8 string (ArgumentError) > from compare.rb:64:in `block in prep_file' > from compare.rb:63:in `each_line' > from compare.rb:63:in `call' > from compare.rb:63:in `each' > from compare.rb:63:in `prep_file' > from compare.rb:144:in `<main>' > > Hm. Okay, I love you ruby, we can just talk this thing out and I can > get back to... > > x.lines.each do |l| > ret << l > end > > # (I love you too) > > Alright baby, Daddy gets confused and angry sometimes... do you wanna > make a little string love...? > > ret = '' > > x = File.open(path) > > x.lines.each do |l| > ret << l > end > > puts ret.class > > # String > > Mhm, it smells like you do. Why don't we take this off... > > x.lines.each do |l| > ret << l > end > > puts ret.gsub!('a', 'test') > > end > ... > compare.rb:69:in `gsub!': broken UTF-8 string (ArgumentError) > from compare.rb:69:in `prep_file' > from compare.rb:145:in `<main>' > > Hey, Ruby, if it's that week of the month we can just cuddle. Here, > try this... > > > x.lines.each do |l| > ret << l > end > > puts ret > ... > # (big string) > > See, thats good. Thats a string and that's something we have in > common, maybe we were just talking about different encodings. Let's > see what it's made of. > > puts ret.encoding > > # UTF-8 > > I'm gonna go get a gallon of milk and I'll be back soon. You wait > right there. (grumbles) I love it. Another person that wants a babel fish. The irony is in the language demonstrating as much. In other words, I need Jazzy Linefeed encoding (I left off the DJ because there might be other types of linefeeds). Todd