Reputation: 801
I am designing web page in slovak language. To be able to use meantioned language special characters such as á or ž, I am using this html code:
<html lang="sk">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
Now it works as expected but only when I hard code that kind of text into html file.
As soon as I use jquery to print them it breaks down and those characters are not correctly shown.
$("#myDiv").html("áž");
Am I supposed to specify something in jquery or is there another way to overcome this problem?
Upvotes: 7
Views: 6427
Reputation: 285
It is quite Easy you can do the following Use any special Character u want
$("#mydiv").text("*&^&*^*&^*");
Here is the Demo
Upvotes: 2
Reputation: 2562
I think you may be use some tricks here
Try this
$("#myDiv").html($("<div>").html("áž").text());
Or simply try this
$("#myDiv").text("áž");
Upvotes: 4
Reputation: 67207
You can pass the numeric entity for that character into the html() function to achieve that,
Try a sample,
$('body').html('Ξ');
Upvotes: 6