0

I have the following text which I manually enter into the wordpress posts table

‚

I encode into utf-8 using:

$text = "‚";
$enc = mb_detect_encoding($text, "UTF-8,ISO-8859-1");
$hotelDescription   = iconv($enc, "UTF-8", $text);

However, when wordpress echoes it it displays

‚

Any ideas who I can output the correct characters?

4

2 に答える 2

0

#226の前の&が欠落しているようです。

于 2012-07-28T00:00:14.173 に答える
0

その文字列を表示するページがUTF-8エンコーディングを使用してレンダリングされるように指定する必要があります。投稿した出力は、そのutf-8文字列のiso-8859-1バージョンです。UTF-8としてデータがデータベースに正しく格納されていると仮定すると、この文字列がレンダリングされているページに次のメタタグがあることを確認してください。

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> 
于 2012-07-28T00:04:44.033 に答える