开发者

Typographer's quotes in PHP on Yahoo

My client is a small newspaper and provides stories with typographer's quotes instead of "straight" quotes. The stories are assembled into HTML by PHP. On my Apache server, they display fine, but on Yahoo, where my client's site is located, they are all replaced开发者_如何学Go by question marks.

To fix this problem, I wrote the following function in PHP:

function fixquotes($text)
{
    $text = str_replace('’','’',$text);
    $text = str_replace('”','”',$text);
    $text = str_replace('“','“',$text);
    return $text;
};

In the function above, I am searching for typographer's quotes to replace them with HTML equivalents. On my local Apache server, it works great. On Yahoo, all typo-quotes convert to the first listed (above: ’).

On my server, magic-quotes is off, but Yahoo has it turned on. I'm not certain if this is the cause of my problem, but it is possible.

I am quite aware of the difference between single and double quoted strings in PHP, and have even tried the above both ways with no difference, so let's not re-plow old ground.

Does anyone have a suggested direction for me to look into?


It's probably a character-set issue, either in Yahoo's web server, or database if this stuff is stored in a database.

Pull out firebug (or similar), and look at the HTTP headers on your dev box, and the live site. You might want to force a header using php's header() function.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜