I have this code:
It shows correctly on Google Chrome:
It just shows odd characters on Safari:
What could be the possible reason why the quote and emoji are not shown correctly?
It's working now
For some reasons, the extension builder of Xcode bundled the javascript strings wrongly
A solution is to convert the background.js to UTF-16. It involve three steps:
Final step, build the Xcode Safari Extension project. You can now use accented characters and emojis to your heart's content
If anyone have a good idea why Xcode cannot build Safari extension straight out of a UTF-8 file, please offer some theory why it is so. Or if there are any other alternative solution to this problem
An bit shorter step (two steps), use iconv commandline utility to convert the UTF-8 file background.js to UTF-16LE, but it's not enough, the emojis and other characters still looks gibberish when Xcode build the project. Still need another step, that is, open the background.js in VS Code and then save it (Ctrl+S or command+S). Looks like VS Code is doing some corrections to a file when a file is set to different encoding. Final step, build the Xcode Safari Extension project