你好,我有两个php文件。其中一个构建报告,第二个包含语言文本。当它打印时,它总是给我任何地方的�特殊字符,即使我在代码中没有使用任何特殊字符。那是为什么,我怎样才能摆脱这些?
我正在运行Apache2.2,php 5,Ubuntu8.04。
档案1
<?php
function glossary() {
return <<<HTML
<h1>Arteries</h1>
<p><strong>Arteries</strong> are blood vessels that carry blood <strong>away from
the heart</strong>. All arteries, with the exception of the pulmonary and umbilical
arteries, carry oxygenated blood. The circulatory system is extremely important for
sustaining life. Its proper functioning is responsible for the delivery of oxygen
and nutrients to all cells, as well as the removal of carbon dioxide and waste products,
maintenance of optimum pH, and the mobility of the elements, proteins and cells of
the immune system. In developed countries, the two leading causes of death, myocardial
infarction and stroke each may directly result from an arterial system that has been
slowly and progressively compromised by years of deterioration.</p>
HTML;
}
?>档案2:
<?php
require_once("language.php");
echo glossary();
?>这是我执行文件2时的打印输出。
术语表动脉
动脉�是�血管�,它将血液�从�心脏转移出去。除�肺动脉�和�脐动脉外,所有动脉均携带氧合血。�循环系统�对于维持�生命极其重要。它的正常功能负责将�氧和�营养物质�输送到所有细胞,去除�二氧化碳�和废品,维持最佳�pH值,以及�免疫系统中元素、蛋白质和细胞的移动性。在�发达国家,�死亡的两个主要原因--心肌梗死�和�中风�--都可能是动脉系统由于多年的恶化而缓慢和逐渐受损的直接原因。自身免疫
自体免疫�是机体不能识别自身构成部分为自身的�自我,从而使机体对自身的细胞和组织产生免疫反应。任何由这种异常免疫反应引起的疾病都被称为�自身免疫性疾病。�基底细胞癌
基底细胞癌�是�皮肤癌最常见的类型。它很少�转移�或杀死,但它仍然被认为是恶性的,因为它可以造成严重的破坏和破坏的�侵袭周围的组织。据统计,大约有3/ 10的白种人在他们的一生中发展为基底细胞癌。在所有病例中,80 %的病例发生在头颈部的基底细胞癌,近年来�的发病率似乎有所上升。
发布于 2009-09-07 07:44:25
尝试删除并重新输入显示为"�“的空格。
我怀疑你重新进入的人会没事的。文档可能包含替换的Unicode空间字符,这些字符通常出现在编辑器中,但在服务器的默认字符集中运行的PHP代码无法识别这些字符。
这个文档最初是来自MS Word还是其他文字处理器?
发布于 2009-09-07 07:55:01
您需要确保将编辑器编码设置为一些合理的东西,如UTF-8。您还应该确保您的输出设置为UTF-8 (或任何与您相关的编码)。这可以使用元标记<meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/>并在输出开始之前设置PHP header('Content-type: text/html; charset=UTF-8');。
发布于 2009-09-07 07:49:51
你检查过你的编码了吗?确保在编辑器、apache、php和正在使用的浏览器中使用相同的编码。
希望这能有所帮助。
https://stackoverflow.com/questions/1388028
复制相似问题