wordpress的标点问题的解决方法

虽然是一个功能强大且受尽全球blogger宠爱的博客系统,但是也还是有些不大不小的毛病,比如这个标点问题,它常常就把一些英文的标点无端的转换成Unicode里的CJK符号,日志内容、链接、评论里皆是如此,虽然不是什么大事,但还总是有那么一点不舒服。

起初怀疑是数据库的字符集问题,转到phpmyadmin下更改了字符集未果,然后网上搜了一索,这才发现出问题的人大有人在,同时也找出来解决方法。如下:

第一种方法,安装Quotmarks Replacer插件。目前版本2.0 Beta,但是我在2.5rc1下测试,只能修复部分问题。

第二种方法,修改修改wp-includes/formatting.php文件。wptexturize()函数的问题,主要是在($static_characters, $static_replacements)和($dynamic_characters, $dynamic_replacements)数组中,怕麻烦的话就直接注释掉。

我不懂函数就直接注释掉:

修改前
if (isset($curl{0}) && '<' != $curl{0} && $next) { // If it's not a tag
// static strings
$curl = str_replace($static_characters, $static_replacements, $curl);
// regular expressions
$curl = preg_replace($dynamic_characters, $dynamic_replacements, $curl);
}

修改后
if (isset($curl{0}) && '<' != $curl{0} && $next) { // If it's not a tag
// static strings
//$curl = str_replace($static_characters, $static_replacements, $curl);
// regular expressions
//$curl = preg_replace($dynamic_characters, $dynamic_replacements, $curl);
}

更简单的就是直接用我修改后的文件替换,懒人哪里都有啊

修改后的formatting.php文件2.5rc1

修改前的效果

修改后的效果

 

 

相关日志

Comments (2)

sq10223月 24th, 2008 at 4:43 下午

我上镜了 呵呵

law3月 24th, 2008 at 4:53 下午

主要是单引号的问题 哈哈

Leave a comment

Your comment