English 中文(简体)
当用户进入 & nbsp; 进入 html 时, html purgier 返回问题标记吗?
原标题:htmlpurifier returning question marks when user enters   into html?
  

这几乎不像是需要净化的 html 代码。

为什么html净化剂会把那个字符串 变成一个问号 当它显然应该是一个空间的时候呢?

我准确的html净化代码是:

//purify the html input
include_once( inc/htmlpurifier-4.4.0/library/HTMLPurifier.auto.php );

$config = HTMLPurifier_Config::createDefault();
$config->set( Core.Encoding ,  UTF-8 );
$config->set( HTML.Doctype ,  HTML 4.01 Transitional );

if (defined( PURIFIER_CACHE )) {
    $config->set( Cache.SerializerPath , PURIFIER_CACHE);
} else {
    # Disable the cache entirely
    $config->set( Cache.DefinitionImpl , null);
}

$input = $_POST["about_me"];

# Help out the Purifier a bit, until it develops this functionality
while (($cleaner = preg_replace( !<(em|strong)>(s*)</1>! ,  $2 , $input)) != $input) {
    $input = $cleaner;
}

$filter = new HTMLPurifier($config);
$htmlpurified_output = $filter->purify($input);

我已经在我的php页页眉中启用了 Outf8, 在保存信息时也启用了 Mysql 。

我能够写入, 保存到 DB, 并在同一页的其他文本区域中重新播放其它 UTF8 字符。 罪犯绝对是 html净化器, 返回问题标记, 而不是实际字符 。

我将回答任何其他我能回答的问题。

最佳回答

答案是...

始终确保您的编码在所有区域设置正确 。

桌子上的“关于我”一行只设定接受 ascii 字符。

抱歉浪费了大家的时间

问题回答

暂无回答




相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签