How do I "UTF-8 encode" my JavaScript files so that Google Chrome can use them in an extension? How do I "UTF-8 encode" my JavaScript files so that Google Chrome can use them in an extension? google-chrome google-chrome

How do I "UTF-8 encode" my JavaScript files so that Google Chrome can use them in an extension?


An easy way to UTF-8 encode your files, is to use an editor that allows you to choose that encoding. If you can't do that, there are (fairly standard) tools on linux/unix system to check (file) and to change (iconv, recode) the encoding. If you use Windows, such tools can be installed.


I ran into this issue even though the file was saved a UTF-8. However the code contained a U+FFFF character, which is invalid by definition. It's the same for U+FFFE.

The solution was to use "\uffff" instead of using the character directly.