プレビューを見ても大丈夫なのに、
いざ投稿すると毎回文字化けしていました。
正確には予約投稿すると文字化けしていました。
<h3>"test"</h3>
が
<h3>"test&quot;</h3>
です。
そこでソースを修正します。
/ips.nekotype.com/wp-content/plugins/syntaxhighlighter/syntaxhighlighter.php
// The callback function for SyntaxHighlighter::encode_shortcode_contents()
function encode_shortcode_contents_callback( $atts, $code = '', $tag = false ) {
$this->encoded = true;
//$code = str_replace( array_keys($this->specialchars), array_values($this->specialchars), htmlspecialchars( $code ) );
$code = str_replace( array_keys($this->specialchars), array_values($this->specialchars), $code );
return '[' . $tag . $this->atts2string( $atts ) . "]{$code}[/$tag]";
}
これで大丈夫かな?
htmlspecialchars — 特殊文字を HTML エンティティに変換する
【追記】
編集画面に戻るとソースが変わってしまいました。
そこで
// The callback function for SyntaxHighlighter::decode_shortcode_contents()
// Shortcode attribute values need to not be quoted with TinyMCE disabled for some reason (weird bug)
function decode_shortcode_contents_callback( $atts, $code = '', $tag = false ) {
$quotes = ( user_can_richedit() ) ? true : false;
//$code = str_replace( array_values($this->specialchars), array_keys($this->specialchars), htmlspecialchars_decode( $code ) );
$code = str_replace( array_values($this->specialchars), array_keys($this->specialchars), $code );
return '[' . $tag . $this->atts2string( $atts, $quotes ) . "]{$code}[/$tag]";
}
これでおそらく大丈夫でしょう・・・。
自信ありませんのでしばらく様子をみます。
ちなみに特殊記号をそのまま表示させたい場合は
最初の&を&にして表示させることになります。
つまり>と表示させたい場合は、
&gt;
と記述します。
