From: Henrik Horneber Date: 2004-12-15T21:44:53+09:00 Subject: Re: File#each_byte returns only the first 300 bytes Niko Schwarz wrote: > Hello, I have the most recent (rc10) version of rubyinstaller for > windows. > everything works fine, except this: > read_bytes returns in text files everything, but in binary files, only > the first 300 bytes. > the snippet i use is > > s = 0 > File.open(fileName) { |f| > f.each_byte { |ch| > ch > 127 or (fh[ch] += 1 and s += 1) > } > > What am I doing wrong? Is it a bug? (hard to believe in such a basic > function). I seem to remember you need to tell Ruby to open files in binary modes on Windows , e.g. File.open(fileName, "rb") HTH Henrik