简体   繁体   中英

special characters in html instead od utf 8 encoding

I have designed a html page where code look like following

<!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. 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).

Therefore, either save it as UTF-8 encoded in your authoring software or change “UTF-8” to “windows-1252”.

Further complications are possible if the server sends an HTTP header that declares character encoding.

I'm sure you copied the - from a non-utf8 charset. 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") .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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