chrischen Posted October 20, 2008 Share Posted October 20, 2008 I have wordpress installed and it displays all character's correctly. However I made a page myself and queried the wordpress database that contained quotes copy and pasted from microsoft word. In my custom page those characters show up as a diamond with a question mark in it. It shows up correctly in the wordpress page so how do I fix this? The html page is set to utf-8 encoding. Thanks, Chris Quote Link to comment https://forums.phpfreaks.com/topic/129260-solved-unicode-display-problem/ Share on other sites More sharing options...
Maq Posted October 20, 2008 Share Posted October 20, 2008 " = " Quote Link to comment https://forums.phpfreaks.com/topic/129260-solved-unicode-display-problem/#findComment-670151 Share on other sites More sharing options...
rhodesa Posted October 20, 2008 Share Posted October 20, 2008 Word sucks cus it uses some non-standard characters. I always have to go in and change them manually. You can try pasting it into Notepad first, but you will loose all your formatting. If you don't want to paste it into notepad, go through and manually change the characters (after you paste it into WP) Quote Link to comment https://forums.phpfreaks.com/topic/129260-solved-unicode-display-problem/#findComment-670152 Share on other sites More sharing options...
chrischen Posted October 20, 2008 Author Share Posted October 20, 2008 Here's the thing though: wordpress displays them correctly. So there must be a way to do so without modifying the original text. Quote Link to comment https://forums.phpfreaks.com/topic/129260-solved-unicode-display-problem/#findComment-670192 Share on other sites More sharing options...
rhodesa Posted October 20, 2008 Share Posted October 20, 2008 does wordpress convert the characters automatically? in a quick google search, i found someone who uses php to convert the characters. it's the last post in this thread: http://codingforums.com/archive/index.php?t-47163.html Quote Link to comment https://forums.phpfreaks.com/topic/129260-solved-unicode-display-problem/#findComment-670197 Share on other sites More sharing options...
Maq Posted October 20, 2008 Share Posted October 20, 2008 I bet wordpress uses this to convert special characters (and quotes): htmlentities($var, ENT_QUOTES); Quote Link to comment https://forums.phpfreaks.com/topic/129260-solved-unicode-display-problem/#findComment-670202 Share on other sites More sharing options...
chrischen Posted October 20, 2008 Author Share Posted October 20, 2008 The htmlentities didn't work. All it did was take the html code and convert it. In wordpress I viewed source and the quote that I converted to work is like this “ instead of like this ". This is odd because when I view it on my custom page that retrieves it from the database for it displays as ". For the other quotes I didn't change it displays as a diamond with a question mark even in view source. I checked the database and it's stored like “ too. The wordpress db is utf-8, so the problem is with PHP. Quote Link to comment https://forums.phpfreaks.com/topic/129260-solved-unicode-display-problem/#findComment-670220 Share on other sites More sharing options...
corbin Posted October 20, 2008 Share Posted October 20, 2008 They're called smart quotes. “” The ASCII codes for them are 147 and 148 (hold alt, hit 0147 and let go, and you'll see them ;p). Chances are, wordpress just replaces them with normal quotes. Quote Link to comment https://forums.phpfreaks.com/topic/129260-solved-unicode-display-problem/#findComment-670387 Share on other sites More sharing options...
chrischen Posted October 20, 2008 Author Share Posted October 20, 2008 No wordpress doesn't. In fact, wordpress is replacing the normal quotes with the smart ones too. Quote Link to comment https://forums.phpfreaks.com/topic/129260-solved-unicode-display-problem/#findComment-670416 Share on other sites More sharing options...
corbin Posted October 20, 2008 Share Posted October 20, 2008 Are you sure? Microsoft fonts have to be used to show smart quotes, so surely wordpress wouldn't replace normal quotes with sideways ones.... Quote Link to comment https://forums.phpfreaks.com/topic/129260-solved-unicode-display-problem/#findComment-670443 Share on other sites More sharing options...
chrischen Posted October 20, 2008 Author Share Posted October 20, 2008 Yes they were replaced. And I fixed the problem by adding mysql_query("SET NAMES utf8"); before queries. Quote Link to comment https://forums.phpfreaks.com/topic/129260-solved-unicode-display-problem/#findComment-670445 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.