I want to ask you what text editor are You using. Long time i had used notepad++(only windows :/) then i used atom, visual studiocode and now i am using visual studio(they are different).
A lot of them have got problem with encoding.. Notepad++ have problem with unix files, atom and visual code studio haven't automatic search of encoding(i damaged a lot of files becouse a lot of them was in ascii, however text editor was set for utf-8)
Visiual studio hasn't this problem but it's huge application and version for macOS isn't too good how for windows. Extensions which this app don't know, don't want to open
Imo Notepad++ is the best. but also the javascript editor is good. Either one will work.