/    Sign up×
Community /Pin to ProfileBookmark

Hindi font not display properly while rendering Javascript

I want to make a quiz on blogger with the help of java script, but Hindi font is not showing correctly, although the options are showing correctly but the question is not. I have also adding utf-8 Meta code and also used google font mukta but still Hindi font is not showing properly. After adding the utf 8 code, the Hindi font is showing correctly when the html file is opened directly in the browser, but after adding it in the blogger, the Hindi font of the question is not showing correctly.
[**You can better understand via this image**](https://i.stack.imgur.com/pGroF.png)

**HTML**

[code]<!DOCTYPE html>
<html >
<head>
<meta charset=”UTF-8″>
<title>Page title</title>
<link rel=”stylesheet” type=”text/css” href=”quiz.css”>
<link href=”https://fonts.googleapis.com/css?family=Bree+Serif|Concert+One|Nunito” rel=”stylesheet”>

</head>
<body>
<div class=”container”>
<h1>Financial Quiz</h1>
<p class=’description’>Test your knowledge on the Finance</p>
<div class=”start-quiz”>
<button class=’start-button dot’>START</button>
</div>
<!– */******************QUESTIONS********/* –>
<div class=’questions’>
<p class=”score”> Score: </p>
<h2 class=’question’></h2>
<ul class=”list”> </ul>

<div class=’submit’>
<button class=”submit-button”>Check Answer</button>
</div>
<div class=’next’>
<button class=”next-button”>Next</button>
</div>

<p class=’question-number’></p>
</div>

<!– */********************COMPLETED PAGE************ –>
<div class=’end-quiz’>
<p class=’end-score’></p>
<p class=’comment’></p>
<button class=”retake-button”>RETAKE QUIZ</button>
</div>
</div>

<script src=”https://code.jquery.com/jquery-3.2.1.min.js”></script>
<script src=”quiz.js”></script>
</body>
</html>
[/code]

**Javascript**

[code]const myQuestions = [{
‘question’: “हिंदी भाषा के कितने मुख्य अंग है?”,
‘answers’: [“एक”, “दो”, “तीन”],
‘correct’: 1
}, {
‘question’: “हिंदी भाषा में वाक्य के कितने मुख्य अंग है?”,
‘answers’: [“एक”, “दो”, “तीन”],
‘correct’: 2
}
];

var score = 0;
var current = 0;

$(document).ready(function() {
$(“.start-button”).click(function() {
$(‘.start-quiz’).hide();
$(‘.next’).hide();
$(‘.questions’).show();
displayQuestion();
$(‘.score’).text(‘Current Score: ‘ + score);
});

$(“.next-button”).click(function(event) {
displayQuestion();
$(‘.next’).hide();
$(‘.submit’).show();
});

$(“.submit-button”).click(function(event) {
if ($(‘li.selected’).length) {
var answer = $(‘li.selected’).attr(‘id’);
checkAnswer(answer);
$(‘.next’).show();
$(‘.submit’).hide();
} else {
alert(‘Please select an answer’);
}
});

$(“.retake-button”).click(function() {
location.reload();
console.log(“Retake button clicked”);
});

$(‘ul.list’).on(‘click’, ‘li’, function(event) {
$(‘.selected’).removeClass();
$(this).addClass(‘selected’);
});

});

function displayQuestion() {
$(‘.question-number’).text(‘Question Number: ‘ + (current + 1) + “/10″);
if (current < myQuestions.length) {
var listQuestion = myQuestions[current];
$(‘h2’).text(listQuestion.question);
$(‘ul.list’).html(”);
for (var i = 0; i < listQuestion.answers.length; i++) {
$(‘ul.list’).append(‘<li id = “‘ + i + ‘”>’ + listQuestion.answers[i] + ‘</li>’);
}
} else {
// show summary that says how many you got correct
displayScore();
}
}

function checkAnswer(answer) {
var listQuestion = myQuestions[current];
if (listQuestion.correct == answer) {
score++;
$(‘li.selected’).addClass(‘correct’);
} else {
$(‘li.selected’).addClass(‘incorrect’);
$(‘li’).eq(listQuestion.correct).addClass(‘correct’);
}
$(‘.score’).text(‘Current Score: ‘ + score);
current++;
}

function displayScore() {
$(‘.questions’).hide();
$(‘.end-quiz’).show();
$(‘.end-score’).text(“Your score is: ” + score + ‘/10’);
if (score >= 8) {
$(‘.comment’).text(‘GREAT JOB!’);
} else {
$(‘.comment’).text(‘You need to work hard’);
}
}[/code]

to post a comment
HTMLJavaScript

13 Comments(s)

Copy linkTweet thisAlerts:
@boohooOct 10.2021 — Please fix your code formatting and post the CSS as well.
Copy linkTweet thisAlerts:
@NogDogOct 10.2021 — @mahiji#1638050 I edited your post to use this forum's (poorly advertised) ... tags, as they work much better than the &lt;/&gt; button in the edit window.
Copy linkTweet thisAlerts:
@mahijiauthorOct 11.2021 — **CSS code**

<i>
</i>body {
box-sizing: border-box;
background-repeat: no-repeat;
background-size: cover;
font-family: 'Nunito', sans-serif;
color: #f2b632;
font-size: 20px;
margin: 0;
width: 100%;
}

h1 {
margin: 60px 60px 0 60px;
font-size: 30px;
padding-bottom: 30px;
border-bottom: 1px solid #b5b5b7;
border-width: 100%;
color: #ffcc00;
text-align: center;
}

h1,
h2 {
text-align: center;
font-weight: bold;
letter-spacing: 3px;
text-transform: uppercase;
width: 100%;
}

h2 {
font-size: 25px;
color: #000000;
}

.description{
color: #db4976;
padding-top: 10px;
padding-left: 5px;
padding-bottom: 10px;
}

button {
margin-top: 20px;
width: 300px;
height: 40px;
background: #5ee1d8;
font-family: 'Dosis', sans-serif;
font-size: 20px;
color: #ff4040;
border: .5px solid #f2b632;
}

.start-quiz {
width: 500px;
height: 300px;
margin: 100px auto;
text-align: center;
padding-bottom: 200px;
color: white;
}

.questions,
.end-quiz {
display: none;
text-align: center;
padding-bottom: 200px;
margin: 100px auto 0 auto;
text-align: center;
width: 500px;
height: 300px;
}

.end-quiz {
border: 2px solid #f2b632;
padding-top: 80px;
height: 100px;
font-size: 30px;
color: #b5b5b7;
}

.question-number,
.score {
font-size: 30px;
color: #b5b5b7;
}

ul {
list-style: none;
padding: 0;
}

li {
border: 1px solid #d6d6cf;
width: 200px;
margin: 10px auto;
font-size: 18px;
border-radius: 5px;
padding: 5px;
color: #000000;
}

.start-button {
color: white;
}

.selected {
background: #f2b632;
color: #252839;
}

.correct {
background-color: green;
}

.incorrect {
background-color: red;
}

.dot {
height: 110px;
width: 110px;
border-radius: 50%;
display: inline-block;
}
Copy linkTweet thisAlerts:
@boohooOct 11.2021 — Can you post the link to the blogger version of it?
Copy linkTweet thisAlerts:
@mahijiauthorOct 11.2021 — @boohoo#1638080 [**Blogger post link**](https://testlpftheme.blogspot.com/2021/10/quiz-2.html)
Copy linkTweet thisAlerts:
@boohooOct 11.2021 — It's not the exact same code, is it?
Copy linkTweet thisAlerts:
@mahijiauthorOct 11.2021 — @boohoo#1638085 this is the same code, i just made some changes in the code.
Copy linkTweet thisAlerts:
@mahijiauthorOct 11.2021 — @boohoo#1638085 Please try this code once in blogger, you will easily understand and solve the problem.
Copy linkTweet thisAlerts:
@boohooOct 11.2021 — I see in the source that your questions get transformed to entities. It's probably Blogger doing that for safety reasons. Try putting this script (but with normal characters from your original source code) to an external file and embed it via &lt;script src="..."&gt;&lt;/script&gt;:

``javascript<i>
</i> const myQuestions = [{
'question': "ह&amp;#2367;&amp;#2306;द&amp;#2368; भ&amp;#2366;ष&amp;#2366; क&amp;#2375; क&amp;#2367;तन&amp;#2375; म&amp;#2369;ख&amp;#2381;य अ&amp;#2306;ग ह&amp;#2376;?",
'answers': ["एक", "द&amp;#2379;", "त&amp;#2368;न"],
'correct': 1
}, {
'question': "ह&amp;#2367;&amp;#2306;द&amp;#2368; भ&amp;#2366;ष&amp;#2366; म&amp;#2375;&amp;#2306; व&amp;#2366;क&amp;#2381;य क&amp;#2375; क&amp;#2367;तन&amp;#2375; म&amp;#2369;ख&amp;#2381;य अ&amp;#2306;ग ह&amp;#2376;?",
'answers': ["एक", "द&amp;#2379;", "त&amp;#2368;न"],
'correct': 2
}
];

function displayQuestion() {
$('.question-number').text('Question Number: ' + (current + 1) + "/10");
if (current &lt; myQuestions.length) {
var listQuestion = myQuestions[current];
$('p.question').text(listQuestion.question);
$('ul.list').html('');
for (var i = 0; i &lt; listQuestion.answers.length; i++) {
$('ul.list').append('&lt;li id = "' + i + '"&gt;' + listQuestion.answers[i] + '&lt;/li&gt;');
}
} else {
// show summary that says how many you got correct
displayScore();
}
}<i>
</i>
``
Copy linkTweet thisAlerts:
@estipendioOct 12.2021 — You mean it should be shown as Hindi text, but it shows wrong for you even in this post? For me it looks correct in Chrome. But in general you could better replace non-ASCII characters with their HTML codes to be sure. The "Entity" column on this site should be what you need, although probably not complete: http://sites.psu.edu/symbolcodes/languages/southasia/devanagari/devanagarichart (archive)

This page does it automatically: http://www.web2generators.com/html-based-tools/online-html-entities-encoder-and-decoder
Copy linkTweet thisAlerts:
@GajniJul 27.2022 — I go by Gajni. I'm new in this gathering. I have a few inquiries concerning this gathering. These inquiries are shown below🙂[🙂](https://astroluna.org/):

https://forum.webdeveloper.com/d/400275-javascript-submit-not-passing-all-form-values

In the event that anybody has data about my inquiry. If it's not too much trouble, give me reply beneath. I'm exceptionally befuddled about this[🤔](https://gosloto.co/uk-49s-lunchtime-results/)[🤔](https://eightyreviews.com/0x0-0x0/).
Copy linkTweet thisAlerts:
@NogDogJul 27.2022 — @Gajni#1645522

Please do not hijack other people's threads.
Copy linkTweet thisAlerts:
@JaneNguyen1018Jul 29.2022 — Bugs on your website? Can't handle it yourself? Looking for a fix? Need HTML/CSS/Javascript/Bootstrap bugs fixed?

I will fix any kind of HTML CSS & Bootstrap & Javascript issues of your site within 1 hour.

https://www.fiverr.com/share/qeY8g2
×

Success!

Help @mahiji spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...