在浏览器中显示为菱形问号的单引号(无数据库或PHP) [英] Single quotes showing as diamond shaped question mark in browsers (no database or PHP)

查看:257
本文介绍了在浏览器中显示为菱形问号的单引号(无数据库或PHP)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理一个网页,我将字符集从iso-8859-1切换到utf-8。

 <!DOCTYPE html PUBLIC -  // W3C // DTD XHTML 1.0 Transitional // ENhttp://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"> 
< html xmlns =http://www.w3.org/1999/xhtml>
< head>
< title> [网站标题]< / title>
< meta http-equiv =Content-Typecontent =text / html; charset = utf-8/>

我只在页面中使用ASCII字符,并且由于utf-8编码超级ASCII,没事的。但是,文中的单引号显示为黑色钻石包围的问号。我已经验证了这些是ASCII单引号(不是直引号)。



我在网上阅读了很多内容,介绍了涉及PHP,魔术引号,数据库配置等。但是,这是一个平面的HTML页面,不会被任何程序渲染。



此外,许多有这个问题的人被告知切换到UTF -8解决问题。这正是我如何介绍问题。



请看http://mch.blackcatwebinc.com/src/events.html 来查看此问题。

解决方案

在ASCII中唯一的引号是单引号'(0x27或者39)和双引号(0x22或者33)。你有什么是一个8位编码,引号是145(0x91)和如果你想要的是UTF-8,你需要将它转换为UTF-8,因为它不是有效的UTF-8;有效的UTF-8(有效的UTF-8)对127(0x7F)以上的字符使用多个字节,并将开始和结束的报价分别设置在U + 2018和U + 2019。


I am working with a web page in which I switched the character set from iso-8859-1 to utf-8. The top of the page reads like this:

<!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>
<title>[title of site]</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

I am only using ASCII characters in the page, and since utf-8 encoding supersets ASCII, this should be fine. However, single quotes in the text are showing up as question marks surrounded by black diamonds. I have verified these are are ASCII single quotes (not straight quotes).

I've read much online that describes solutions to the problem that involve PHP, magic quotes, database configuration, etc. However, this is a flat HTML page that isn't being rendered by any programs.

Also, many who have this problem are told to switch to UTF-8 to fix the problem. This is exactly how I introduced the problem.

Please look at http://mch.blackcatwebinc.com/src/events.html to see this problem.

解决方案

The only quotes in ASCII are the single quote ' (0x27 or 39) and the double quote " (0x22 or 33). What you have there is an 8-bit encoding that places quotes at 145 (0x91) and 146 (0x92) called CP1252; it's the standard 8-bit Western European encoding for Windows. If what you want is UTF-8, you need to convert that to UTF-8, since it's not valid UTF-8; valid UTF-8 uses multiple bytes for characters above 127 (0x7F), and places the opening and closing quotes at U+2018 and U+2019 respectively.

这篇关于在浏览器中显示为菱形问号的单引号(无数据库或PHP)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆