Is there any gem which adds # encoding: UTF-8 to each Ruby file automatically?
Or is there any other way to prevent from the invalid multibyte cha
Adding a # encoding: UTF-8 to each Ruby file automatically makes only sense, when your files are really stored in UTF-8.
If your files are encoded CP850 (AFAIK default in Windows) and you use Non-ASCII characters, you replace invalid multibyte char (US-ASCII) with invalid multibyte char (UTF-8).
I would prefer a manual modification and check of each file, if it is really UTF-8.