From: James Gray Date: 2008-09-20T01:34:19+09:00 Subject: [ruby-core:18748] Re: Request: File.binread (Or File.read_binary) On Sep 19, 2008, at 8:12 AM, James Gray wrote: > Interestingly, I was having basically the same idea for fixing my > problem. I thought I would read() some byte count and try a > harmless operation on the end of the String that would trigger the > bad data error, if it is there. While it is, I would keep reading > one more byte. This strategy seems to work. However, avoid my "try a harmless operation on the end of the String that would trigger the bad data error" idea. I ran into trouble with that route. Instead, use String#valid_encoding?. James Edward Gray II