Edge 42(17133) garbled since <script> default charset do not follow html charset in document.write

External Issue #16846720

Details

Created
Apr 10, 2018
Privacy
This issue is public.
Found in
  • Microsoft Edge
Found in build #
42.17133
Reports
Reported by 1 person

Sign in to watch or report this issue.

Steps to reproduce

Edge Browser:
Microsoft Edge 42.17133.1.0
Microsoft EdgeHTML 17.17133
OS:
Windows specifications
Edition: Windows 10 Enterprise
Version: 1803
Installed on: 3/31/2018
OS build: 17133.1

Sample code to reproduce this issue

  1. Edge42Issue.html
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" “http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <!-- default charset of <script> in document.write should follow this charset setting–>
    <meta http-equiv="content-type” content="text/html; charset=UTF-8">
    </head>
    <body>
    <input type="hidden" id="content" value=’
    <html>
    <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <script type="text/javascript" src="./message.js" ></script>
    </head>
    <body>
    <div id ="message"></div>
    <script type="text/javascript">
    document.getElementById(“message”).innerHTML = message[“content”];
    </script>
    </body>
    </html>
    '>
    <script language="javascript">
    var content = document.getElementById(“content”).value;
    window.onload = function() {
    document.write(content);
    }
    </script>
    </body>
    </html>

  2. message.js (this is utf-8 encoding)
    var message = {"content":"中文字符 means Chinese characters(multiple-byte)"};

Expected: 中文字符 means Chinese characters(multiple-byte)
Actually: 中文字符 means Chinese characters(multiple-byte)

The sample code have been attached, only found this issue in Edge 42(preview), older Edge and all other browsers do not have such issue.

BTW, this issue can work around by specific charset to script in document.write
<script type="text/javascript" src="./message.js" charset="utf-8"></script>

Attachments

1 attachment

Comments and activity

  • Attachment file “Edge42Issue.html” missed the content settings, please add following code into this file then you can reproduce it.

    The pasted content in this page is correct.

  • Please use pasted content in this page, Edge42Issue.html missed in header.

  • Microsoft Edge Team

    Changed Assigned To to “James M.”

    Changed Assigned To to “Scott L.”

    Changed Assigned To to “Travis L.”

    Changed Title from “Edge 42(17133) garbled since <script> default charset do not follow html charset in document.write” to “Edge 42(17133) garbled since <script> default charset do not follow html charset in document.write”

    Changed Status to “External”

  • This issue has been resolved External. This means this issue may require a new feature to be implemented or other work that is more significant than a typical bug. You may be able to find more information on this issue by searching for related features on status.microsoftedge.com and uservoice.microsoftedge.com.

You need to sign in to your Microsoft account to add a comment.

Sign in