javascript - Invalid characters in a HTML page - Stack Overflow

I'm using JavaScript to get the elements under the clicked elements in my website. And I'm se

I'm using JavaScript to get the elements under the clicked elements in my website. And I'm sending the content to server side.

But some times, I'm getting some invalid characters like: â€, â–º, etc.

What is the reason for this? And how to correct it?

I'm using JavaScript to get the elements under the clicked elements in my website. And I'm sending the content to server side.

But some times, I'm getting some invalid characters like: â€, â–º, etc.

What is the reason for this? And how to correct it?

Share Improve this question edited Mar 26, 2015 at 20:24 Rizier123 59.7k17 gold badges104 silver badges164 bronze badges asked Aug 13, 2012 at 0:15 StrangerStranger 10.7k18 gold badges84 silver badges120 bronze badges 2
  • @HugoDozois Can you please give me an example? – Stranger Commented Aug 13, 2012 at 0:19
  • look at php/manual/fr/function.utf8-encode.php and php/manual/fr/function.utf8-decode.php – Hugo Dozois Commented Aug 13, 2012 at 0:21
Add a ment  | 

2 Answers 2

Reset to default 3

†looks like utf-8 being misinterpreted as Windows-1252. Try setting the encoding for your pages:

<?php
header( "Content-Type: text/html; charset=utf-8");

or if you prefer in .htaccess file:

AddDefaultCharset UTF-8

Sometimes characters such as ' " , . / \ ; : & % $ # @ * (basically all symbols) and others are formatted differently if they are copied from another location. Go though and replace all punctuation and other symbols with themselves and those weird characters should go away.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745265041a4619403.html

相关推荐

  • javascript - Invalid characters in a HTML page - Stack Overflow

    I'm using JavaScript to get the elements under the clicked elements in my website. And I'm se

    4小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信