{"id":8400,"date":"2011-07-19T23:53:17","date_gmt":"2011-07-19T23:53:17","guid":{"rendered":"http:\/\/wpml.org\/?post_type=faq&#038;p=8400"},"modified":"2023-09-06T11:34:11","modified_gmt":"2023-09-06T11:34:11","slug":"texts-showing-as","status":"publish","type":"faq","link":"https:\/\/wpml.org\/th\/faq\/texts-showing-as\/","title":{"rendered":"Why are my texts showing as \u2013 ???????"},"content":{"rendered":"<p class=\"lead\">Your texts are showing as ??????? because your database character encoding is different from UTF-8.<\/p>\n<p>If you&#8217;re using <strong>PHPMyAdmin<\/strong>, the structure of your <strong>wp_posts<\/strong> table should look something like this:<\/p>\n<figure id=\"attachment_8401\" aria-describedby=\"caption-attachment-8401\" style=\"width: 373px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" class=\"size-full wp-image-8401 \" title=\"wp_posts_phpmyadmin\" src=\"http:\/\/wpml.org\/wp-content\/uploads\/2011\/07\/wp_posts_phpmyadmin.png\" alt=\"\" width=\"373\" height=\"370\" srcset=\"https:\/\/wpml.org\/wp-content\/uploads\/2011\/07\/wp_posts_phpmyadmin.png 373w, https:\/\/wpml.org\/wp-content\/uploads\/2011\/07\/wp_posts_phpmyadmin-150x148.png 150w, https:\/\/wpml.org\/wp-content\/uploads\/2011\/07\/wp_posts_phpmyadmin-300x297.png 300w\" sizes=\"(max-width: 373px) 100vw, 373px\" \/><figcaption id=\"caption-attachment-8401\" class=\"wp-caption-text\">wp_posts viewed from PHPMyAdmin<\/figcaption><\/figure>\n<p>If you see a different value for the <strong>collation<\/strong>, it means that the character encoding is wrong. This will cause text to display incorrectly because the browser doesn&#8217;t know how to show non-English characters.<\/p>\n<h2>How can I fix this issue?<\/h2>\n<p>First, <strong>make sure to backup your database<\/strong>.<\/p>\n<p>All you need to do is run ALTER statements which will go through your data and change it from its current encoding to UTF-8. The easiest way to do this is by using the <a href=\"https:\/\/wordpress.org\/plugins\/database-collation-fix\/\" target=\"_blank\" rel=\"noopener\">Database Collation Fix<\/a>\u00a0plugin.<\/p>\n<p>In essence, your database needs to be adjusted using the following two SQL statements:<\/p>\n<pre>ALTER TABLE $table DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci\r\nALTER TABLE $table CHANGE $field_name $field_name $field_type CHARACTER SET utf8 COLLATE utf8_bin<\/pre>\n<h2>How can I prevent this from happening again?<\/h2>\n<p>Finally, to make sure that you&#8217;re not skewing away from UTF-8 in the future, edit your <strong>wp-config.php<\/strong> file and set the charset definition correctly.<\/p>\n<p>It should say:<\/p>\n<pre>\/** Database Charset to use in creating database tables. *\/\r\ndefine('DB_CHARSET', 'utf8');\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Your texts are showing as ??????? due to a database encoding mismatch. Fix it by running the SQL ALTER statements or using the Database Collation Fix plugin.<\/p>\n","protected":false},"author":2,"featured_media":0,"menu_order":40,"template":"","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"ep_exclude_from_search":false,"footnotes":""},"faq-category":[26133],"class_list":["post-8400","faq","type-faq","status-publish","hentry","faq-tags-charset","faq-tags-utf8","faq-category-troubleshooting"],"_links":{"self":[{"href":"https:\/\/wpml.org\/th\/wp-json\/wp\/v2\/faq\/8400","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpml.org\/th\/wp-json\/wp\/v2\/faq"}],"about":[{"href":"https:\/\/wpml.org\/th\/wp-json\/wp\/v2\/types\/faq"}],"author":[{"embeddable":true,"href":"https:\/\/wpml.org\/th\/wp-json\/wp\/v2\/users\/2"}],"version-history":[{"count":8,"href":"https:\/\/wpml.org\/th\/wp-json\/wp\/v2\/faq\/8400\/revisions"}],"predecessor-version":[{"id":14351865,"href":"https:\/\/wpml.org\/th\/wp-json\/wp\/v2\/faq\/8400\/revisions\/14351865"}],"wp:attachment":[{"href":"https:\/\/wpml.org\/th\/wp-json\/wp\/v2\/media?parent=8400"}],"wp:term":[{"taxonomy":"faq-category","embeddable":true,"href":"https:\/\/wpml.org\/th\/wp-json\/wp\/v2\/faq-category?post=8400"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}