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 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. 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? 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. 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; } 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. 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 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
Archived
This topic is now archived and is closed to further replies.