wordpress中引号转义的问题
昨天发贴说解决了wp中中文乱码的问题,但是马上又发现帖子中的代码:
$this->query("SET NAMES 'utf8'");
代码中的引号在mysql数据库中存的都没问题,但用wp显示出来就变成全角的了。
google后知道这是wp-includes\functions-formatting.php 中的 wptexturize() 函数在搞鬼
解决办法:
1 使用 sparanoid 的 quotmarks-replacer 解决.(我最后就用这招了)
2 把wptexturize中转义的那几行代码注释掉
3 见下面wordpress官方论坛中给的2个插件
下面内容来自worpdress官方论坛
Quotation Mark/Apostrophe Switch
引号 分号 转义
http://wordpress.org/support/topic/32803?replies=3
Q:
Hello, I use Verdana font for my website and I noticed when I submit a post or page or even a comment it replaces my quotation marks and apostrophes with different ones. The new ones tend to be curved and run into my text. Any ideas?
A:
It's part of the formatting features in WordPress (what's known as the wptexturize function). You can turn this off by commenting out any of the add_filter lines in wp-includes/default-filters.php that use wptexturize, or by editing the function in wp-includes/functions-formatting.php.
Another, fancier option is to use a plugin to control text formatting:
http://dev.wp-plugins.org/wiki/TextControl
http://www.vapourtrails.ca/wp-preformatted