Reputation: 59
i have a form for post comments but when i comment with words that have accents, accents does not appear. i have this :
> bla èèèèème
i have this on header :
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
so it's a problem with php but I do not know what to add in the form
My form :
<?php print_comments();?>
<h3> Add comments </h3>
<form action="article1.php" method="post" >
<span class="input-label">Name</span>
<input type="text" required name="comment_name"
<br/>
<br/>
<span class="input-label">Email</span>
<input type="text" required name="comment_email"
<br/>
<br/>
<textarea class="input-label" name="comment" required rows="5" cols="30"></textarea>
<br/>
<br/>
<input type="hidden" name="article_id" value="<?php echo $article['_id'];?>" />
<input type="submit" name="btn_submit" value="Save"/>
</form>
</body>
</html>
Everything appears correctly except comments
Upvotes: 0
Views: 490
Reputation: 495
Probably while you are saving your post in the DB, you are encoding the entities which make the Ampersand (&) to be & and therefore nullifies the remaining characters from being part of the entity.
You can fix this by performing html_entity_decode() on your output string before printing it to the page.
e.g
<?php echo html_entity_decode($comments); ?>
Upvotes: 1