【发布时间】:2012-02-13 10:13:26
【问题描述】:
我如何“要求”htmlentities() 不要转换某些符号?例如,
php,
<?php echo htmlentities(file_get_contents('fonts.css'),ENT_QUOTES);?>
字体.css,
@font-face {
font-family: 'ChunkFiveRoman';
src: url('chunkfive-webfont.eot'); /* EOT file for IE */
src: local('☺'), url('chunkfive-webfont.ttf') format('truetype'); /* TTF file for CSS3 browsers */
}
结果,
@font-face {
font-family: 'ChunkFiveRoman';
src: url('chunkfive-webfont.eot'); /* EOT file for IE */
src: local('�'), url('chunkfive-webfont.ttf') format('truetype'); /* TTF file for CSS3 browsers */
}
我想保持 '☺' 原样,但不想将其转换为 'âº'。
有可能吗?
【问题讨论】:
-
htmlentities不能这样工作,所以问题出在其他地方。也许您的 css 文件是用 utf-8 编码的,但您将其显示为单字节编码的 HTML? -
谢谢乔恩。可能我正在以单字节编码将 css 显示为 HTML ......但现在它似乎与 mario 的答案一起工作正常。
标签: php special-characters html-entities