Is there a way to remove the BOM from a UTF-8 encoded file?
With ruby >= 1.9.2 you can use the mode r:bom|utf-8 This should work (I haven’t test it in combination with json): json = nil #define the variable outside the block to keep the data File.open(‘file.txt’, “r:bom|utf-8”){|file| json = JSON.parse(file.read) } It doesn’t matter, if the BOM is available in the file or not. Andrew remarked, …