From: Xuan Date: 2008-06-28T03:37:38+09:00 Subject: Re: File question On Jun 27, 6:21 pm, Justin To wrote: > I have another problem also: > > File.open("genver.txt", 'r').each do |x| >   puts x > end > > The file contains: > v4 > > But 'puts x' outputs ˙ūv Nul4 Nul > -- > Posted viahttp://www.ruby-forum.com/. Hello, Instead of c.chomp! as it was suggested, use c=c.chomp(" ") before the "if"statement. The problem seems to be a white space at the end of "c".. if you use print instead of puts you'll see it. About your second problem I just tested it and works fine for me. Maybe txt file encoding is wrong...be sure to save it with utf-8 enc.