Special character in "entrée" cannot be displayed correctly if defined in a separate javascript file

Posted by Jazure on Stack Overflow See other posts from Stack Overflow or by Jazure
Published on 2010-04-30T18:13:13Z Indexed on 2010/04/30 18:17 UTC
Read the original article Hit count: 179

Example:

The following string is defined in a json.js file.

var test = "One complimentary entrée with the purchase of an entrée.";

It is included in an index.html file by

  <script type="text/JavaScript" src="./json.js"></script>

When the string is displayed in UI, it shows up as

"One complimentary entr?e with the purchase of an entr?e."

But if string is defined directly in the index.html, then it is not a problem.

Can anyone suggest a solution on how to keep the text in the separate .js file?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about encoding