From: Brian Candler Date: 2009-10-28T00:21:17+09:00 Subject: Re: Marshal erro with non ascii chars Marcelo Cavaco wrote: > if the second line of array contain a file name with non asciii char, > the loop dont work. > > when the line 4 is executed, the next loop is executed. Prove it or disprove it, by adding some printing. Here is a starting point: > line 1 - scbase = File.open(source, 'rb') { |f| Marshal.load f } STDERR.puts scbase.inspect > line 2 - scbase.each do |myfiles| STDERR.puts "Processing #{myfiles.inspect}" > line 3 - myfiles[1].gsub! ':', ' ' > line 4 - path = folder + myfiles[1] + '.txt' STDERR.puts "path = #{path.inspect}" > line 5 - myfiles_text = Zlib::Inflate.inflate(myfiles[2]) STDERR.puts "read #{myfiles_text.size} characters" > line 6 - File.open(path, 'wb') {|file| file.write (myfiles_text) } STDERR.puts "written #{path.inspect}" > line 7 - end As you find out exactly which lines are or are not being executed, then add further debugging. > the line 2 is ignored and only 2 files is created. > > but there is no error. Seems unlikely. Loops don't just silently restart, and you are not catching any exceptions. One thought: what version of ruby are your running under? Your example has a filename containing "*", but that is an ASCII char. If you really have non-ASCII characters, then ruby 1.9 may barf in unexpected ways. But this still doesn't explain what you describe. -- Posted via http://www.ruby-forum.com/.