Emoji are not loaded from external json files
Reported by
dijis...@gmail.com,
Nov 8
|
||||
Issue description
UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36
Steps to reproduce the problem:
1. I am trying to create a list with Emoji Flag, Country name and code loading all the info from external js file which has all JSON info and is attached.
My complete code is as shown below:
<body>
<select id="MccDrpDwnUid" onchange="MccSltChjFnc()"></select><br><br>
<label type="text"><span id="MccLblTxtUid">91</span>
<input type="text" placeholder="Mobile">
</label>
</body>
<script type="text/javascript" src="MccAndFlg.js"></script>
<script>
var MccDrpDwnVar = document.getElementById("MccDrpDwnUid");
var MccLblTxtVar = document.getElementById("MccLblTxtUid");
MccJryVar.map(function(ItmRsgVar)
{
MccDrpDwnVar.innerHTML +=
"<option value='"+ItmRsgVar.MccVak+"'>"
+ ItmRsgVar.EmjVak + " "
+ ItmRsgVar.NamVak
+ " ( +"+ ItmRsgVar.MccVak + " )"
+ "</option>"
})
</script>
2. If I run above I just get wired char in place of Country emoji
3. But if I add one comment as below just above the map function, All emoji will be loaded correctly
// "Emoji": "🇮🇳",
A browser is not able to load emoji without a comment and it loads only after putting this comment. So Kindly address this issue and take the necessary action
2.
3.
What is the expected behavior?
Emoji Flags need to be loaded from external json var without use of any comments
What went wrong?
Emoji Flags are displayed as some wired chars when loaded
Did this work before? N/A
Chrome version: 70.0.3538.77 Channel: stable
OS Version: OS X 10.11.5
Flash Version:
,
Nov 8
This is really weird. There need to be an emoji in the JS comment, or presumably somewhere in the JS, for the map over the JSPON loaded dict to correctly process the emoji. Note the original attached file works because it has the emoji in the comment. The file attached to this comment has the emoji comment line removed, and fails on M-70 and M-72. Assigning to Javascript because it seems that a change in JS affecting the fonts is a JS issue. Could be fonts though, but it's hard to see the connection.
,
Nov 15
Mathias, could the reason here be the recent changes to JSON?
,
Nov 15
,
Nov 15
This is unrelated to the JSON.stringify update, or any recent change in V8. The HTML document is missing <meta charset=utf-8>. Without the emoji comment in the HTML source, the document consists of ASCII symbols entirely, and so we interpret it and any of its <script> dependencies as windows-1252. In other words, `document.charset === 'windows-1252'`. With the emoji comment in the HTML source, Chrome correctly guesses that the document must be UTF-8 (i.e. `document.charset === 'UTF-8'`), and applies the same charset to its <script> dependencies. That’s why it appears to render correctly in this scenario. Add `<meta charset=utf-8>` to the HTML document or serve it with `Content-Type: text/html; charset=utf-8` to solve the problem. This is not a bug in Chrome. |
||||
►
Sign in to add a comment |
||||
Comment 1 by vamshi.kommuri@chromium.org
, Nov 8