Reading Text File with Byte Order Mark Using Ruby
Ruby’s File.read()
can natively read a text file containing a byte order mark and strip it out:
text_without_bom = File.read("file.txt", encoding: "bom|utf-8")
Written on November 8, 2016 by shahriyarnasir