Friday, May 17, 2024
 Popular · Latest · Hot · Upcoming
180
rated 0 times [  187] [ 7]  / answers: 1 / hits: 54457  / 7 Years ago, sat, june 17, 2017, 12:00:00

I am trying to set charset=utf-8 inside the javascript file itself, not in the script tag,
I know that I can do this:



<script type=text/javascript charset=UTF-8 src=xyz.js></script>


But unfortunately, this solution needs me to do the same step with hundreds of websites which are using the same script. so I am trying to set the charset in the javascript file itself.
Is this possible?



thanks


More From » utf-8

 Answers
101

I found another way, so instead of declaring charset=UTF-8 for the script tag like this:



<script type=text/javascript charset=UTF-8 src=xyz.js></script>


I can declare the charset for the web page itself using meta tag, so I can append <meta charset=UTF-8> to the DOM dynamically, and end up with something like:



<head>
...
<meta charset=UTF-8>
...
</head>

[#57414] Thursday, June 15, 2017, 7 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
gregorio

Total Points: 362
Total Questions: 95
Total Answers: 93

Location: Puerto Rico
Member since Sun, Jun 27, 2021
3 Years ago
;