最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

php - Plugin won't output characters with diacritics properly

programmeradmin4浏览0评论

I'm developing a custom plugin for a Wordpress based website. I have a function that will output some html to the site like this:

function display_content()
{
    $content = '<div><p>Śóme ćóńtęńt with diąćritićś</p></div>';
    return $content;
}

add_shortcode('my_shortcode', 'display_content');

On the website the output of this shortcode will have all the characters with diacritics replaced by '�'. The content that is not generated by the plugin does not have this issue. The characters look fine in the source code too.

It's some encoding problem, but I can't find what is the source of it. Is Wordpress or the server misconfigured? Am I doing something wrong with this plugin?

I looked online but it's extremely hard to find anything in the 1000s of results about wrong encoding in the database. I don't think this applies here since the content from the database looks fine, but I'm pretty new to WP and I might be wrong here.

发布评论

评论列表(0)

  1. 暂无评论