There\'s a bug I\'m trying to track down here: https://github.com/OscarGodson/EpicEditor/issues/184#issuecomment-8805982
Based on all the information it seems
As Alohci said, creating charset-related meta tags from JS won't have much effect on the current page.
In my usecase, I need to be able to serialize the current page as a string and save it to some backend. Appending a missing charset meta tag (if not present) is useful for such an usecase.
As a side-node, don't forget that the charset metatags should be at the beginning of according to the HTML5 spec. See this answer. This simple detail has lead to an important bug in my app :)
You should rather use:
document.head.insertBefore(charsetMetaTag,document.head.firstChild);