简体   繁体   English

html中的特殊字符,而不是od utf 8编码

[英]special characters in html instead od utf 8 encoding

I have designed a html page where code look like following 我设计了一个html页面,其中的代码如下所示

<!DOCTYPE   html    PUBLIC  "-//W3C//DTD XHTML 1.0 Transitional//EN"    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html   xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta   http-equiv="Content-Type"   content="text/html; charset=UTF-8"  />
<title>Title</title>
</head>
<body   style="margin:0;">
<div    id="alignment"  align="center">
<table  id="border" bgcolor="#e5e5e5"   border="0"  cellpadding="20"    cellspacing="0"         width="726">
<tr>
<td style="font-family: Arial,  Helvetica,  sans-serif; font-size:  19px;   color:  #FFF;background:#080808;" align="left">hi–boss</td>
</tr>   
</table>
</div>
</body>
</html>

but in output I get hi boss instead of hi- boss. 但是在输出中我得到了老板而不是老板。

Can any one say , what I miss here. 谁能说,我在这里想念什么。

Many thanks in advance 提前谢谢了

Your document is in fact not UTF-8 encoded but probably windows-1252. 您的文档实际上不是UTF-8编码的,但可能是Windows-1252。 You will see this if you manually use the View menu of your browser and there set the encoding to windows-1252 (it may appear under the name “West European” (Windows) for example). 如果您手动使用浏览器的“查看”菜单,并将编码设置为Windows-1252(例如,它可能显示在“西欧”名称下(Windows),则将显示)。

Therefore, either save it as UTF-8 encoded in your authoring software or change “UTF-8” to “windows-1252”. 因此,可以将其另存为创作软件中编码的UTF-8,也可以将“ UTF-8”更改为“ windows-1252”。

Further complications are possible if the server sends an HTTP header that declares character encoding. 如果服务器发送声明字符编码的HTTP标头,则可能会进一步复杂化。

I'm sure you copied the - from a non-utf8 charset. 我确定您是从非utf8字符集复制了- You have to specify this in you meta-tags, use '-' (the one on your keyboard), or if you use php eg call utf8_encode("text") . 您必须在元标记中指定此名称,使用'-'(键盘上的那个),或者如果您使用php,请调用utf8_encode("text")

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

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