opel2010 Posted January 15, 2010 Share Posted January 15, 2010 Hi all, my first post - so hope this makes sense and you guys can help, I am using wordpress to store information and then run mysql select queries to extract data and display on certain webpages, One of the titles of a post includes the character: é when I extract this from the database and echo it all I get is: � Qustion: How do I get this to echo é and not � ? thanks, opel Quote Link to comment https://forums.phpfreaks.com/topic/188556-echoing-sol%C3%A9-and-getting-sol%EF%BF%BD/ Share on other sites More sharing options...
oni-kun Posted January 15, 2010 Share Posted January 15, 2010 Is your table charset set as utf-8? You may want to use utf8_encode on the string before it is placed into the database. Quote Link to comment https://forums.phpfreaks.com/topic/188556-echoing-sol%C3%A9-and-getting-sol%EF%BF%BD/#findComment-995472 Share on other sites More sharing options...
opel2010 Posted January 15, 2010 Author Share Posted January 15, 2010 I've checked and its set to: utf8_general_ci Should I change this? Quote Link to comment https://forums.phpfreaks.com/topic/188556-echoing-sol%C3%A9-and-getting-sol%EF%BF%BD/#findComment-995474 Share on other sites More sharing options...
oni-kun Posted January 15, 2010 Share Posted January 15, 2010 I've checked and its set to: utf8_general_ci Should I change this? Yes, try changing it to utf8_unicode_ci and see what happens. Quote Link to comment https://forums.phpfreaks.com/topic/188556-echoing-sol%C3%A9-and-getting-sol%EF%BF%BD/#findComment-995475 Share on other sites More sharing options...
opel2010 Posted January 15, 2010 Author Share Posted January 15, 2010 no joy I'm afraid, when I view in PhpMyAdmin, I can see 'Solé' so I guessing its something to do with me extracting into a string and then later echoing that string? $conn = @mysql_connect("1.1.1.1", "user", "pass") or die(mysql_error()); mysql_select_db("picweb",$conn) or die(mysql_error()); $sql = "SELECT wp_posts2.* FROM `wp_posts2`, `wp_term_relationships` WHERE (`wp_posts2`.`id` = `wp_term_relationships`.`object_id`) AND `term_taxonomy_id` =99 AND `post_status` = 'publish' ORDER BY `id` DESC"; $result = mysql_query($sql, $conn) or die(mysql_error()); while ($show_results = mysql_fetch_array($result)) { $ID = $show_results['ID']; $Resort = null; $Resort = $show_results['post_title']; echo $Resort; } Quote Link to comment https://forums.phpfreaks.com/topic/188556-echoing-sol%C3%A9-and-getting-sol%EF%BF%BD/#findComment-995490 Share on other sites More sharing options...
oni-kun Posted January 15, 2010 Share Posted January 15, 2010 Try using $Resort = utf8_encode($show_results['post_title']); I'm sure if it's proper in the PHPmyAdmin it should be able to be displayed properly. Quote Link to comment https://forums.phpfreaks.com/topic/188556-echoing-sol%C3%A9-and-getting-sol%EF%BF%BD/#findComment-995494 Share on other sites More sharing options...
opel2010 Posted January 15, 2010 Author Share Posted January 15, 2010 perfect that worked a dream Quote Link to comment https://forums.phpfreaks.com/topic/188556-echoing-sol%C3%A9-and-getting-sol%EF%BF%BD/#findComment-995496 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.