Reputation: 20204
I have this code but it only works using english characters
$( "input[name*='Name']" ).attr("placeholder","姓名");
My web page displays other chinese characters just fine and if I change the chinese characters to "Name", it starts working again just fine. Is there something special I have to do here?
In the header, I do see this as the encoding...
<meta http-equiv="content-type" content="text/html; charset=utf-8">
Upvotes: 1
Views: 11057
Reputation: 2511
If the script is inline (in the HTML file), then it's using the encoding of the HTML file and you won't have an issue.
If the script is loaded from another file:
<script type="text/javascript" charset="utf-8" src="..."></script>
> I tried to see what the spec said should happen in the case of mismatching charsets defined by the tag and the http headers, but couldn't find anything concrete, so just test and see if it helps.Upvotes: 5