Fix gsub when file has invalid utf-8

http://robots.thoughtbot.com/fight-back-utf-8-invalid-byte-sequences