Answer the question
In order to leave comments, you need to log in
How to display a page with one encoding on a page with another encoding?
There is a page in utf-8 encoding. The body of the page contains a string containing the page in another obviously unknown encoding. You need to somehow display this line on the page. Tried to insert this string into an iframe but it displays the string in the parent page's encoding. At the same time, it is known that if you feed a page in an iframe in an unknown encoding via src, there are no problems. Code example:
<!doctype html><html>
<head><meta charset="utf-8"></head>
<body>
<p>Строка в кодировке utf-8.</p>
<iframe width="600" height="300"></iframe>
<script>
var unknown_charset_page = '<!doctype html><html>
<head><meta charset="windows-1251"></head>
<body><p>??? ??????windows-1251.</p></body></html>';
document.querySelector('iframe').contentWindow.document.write(unknown_charset_page);
</script>
</body>
</html>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question