简体   繁体   English

HTML页面中的无效字符

[英]Invalid characters in a HTML page

I'm using JavaScript to get the elements under the clicked elements in my website. 我正在使用JavaScript来获取网站中单击的元素下面的元素。 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? 以及如何纠正呢?

†looks like utf-8 being misinterpreted as Windows-1252. â€看起来像UTF-8被误解为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: 或者,如果您希望使用.htaccess文件:

AddDefaultCharset UTF-8

如果从其他位置复制字符,例如' " , . / \\ ; : & % $ # @ * (基本上是所有符号)和其他字符的格式会有所不同,但是请使用所有标点符号和其他符号替换它们本身和那些奇怪的字符字符应该消失。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM