open files in binary mode to avoid automatic transcoding in ruby 1.9