2015-04-22 25 views
0

我有一個表單發表評論,但是當我評論有重音的單詞時,重音不會出現。我有這樣的:口音沒有顯示與php

> bla èèèèème 

我有這樣的標題: <meta http-equiv="content-type" content="text/html; charset=utf-8"/>

所以這是PHP的問題,但我不知道該怎麼在窗體中添加

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> 

一切顯示正確評論除外

回答

1

可能在您將自己的帖子保存在數據庫中時,您正在編碼使&符號的實體(&)爲&,因此將其餘字符廢棄爲實體的一部分。

您可以通過在將輸出字符串打印到頁面之前對其執行html_entity_decode()來解決此問題。

e.g

<?php echo html_entity_decode($comments); ?> 
0

添加在你的PHP腳本ini_set('default_charset', 'UTF-8');

+0

還好我要去考 – asm95