Remove BOM character from UTF-8 encoded file.

With ruby, if you read a file and find characters like this on beginning of file:

\xEF\xBB\xBF

These are BOM characters. By encoding the content forcefully into UTF-8 these characters will get removed. Do something like this:

file = File.open("#{file_name}\\game.json", "r") 
content = file.read.force_encoding("UTF-8")

Done.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store