azazel141 Posted April 28, 2008 Share Posted April 28, 2008 Hi, I'm trying to substring the first character from every value in an array. But if that value happens to be a special character then it won't display correctly. Using htmlentities() doesn't work either, it displays â instead of " . Thank you for your time and effort. substr($array[$teller][0] , 0, 1); //$teller is a counter to go over all the rows Example values: “Les Chenevottes” (the quotes don't display properly) Woop Woop Shiraz wit produkt Whitehall Lane Winery Sauvignon Blanc Vosne-Romanée Link to comment https://forums.phpfreaks.com/topic/103227-solved-substring-special-characters/ Share on other sites More sharing options...
effigy Posted April 28, 2008 Share Posted April 28, 2008 That's not a regular quote, but a "smart quote." Where is this data set coming from? You may be able to iconv it; otherwise, you can replace these with normal quotes: references. Link to comment https://forums.phpfreaks.com/topic/103227-solved-substring-special-characters/#findComment-528841 Share on other sites More sharing options...
azazel141 Posted April 28, 2008 Author Share Posted April 28, 2008 It comes from a SQL database. while($row = mysqli_fetch_array($result)){ $array[] = $row; } Link to comment https://forums.phpfreaks.com/topic/103227-solved-substring-special-characters/#findComment-528842 Share on other sites More sharing options...
effigy Posted April 28, 2008 Share Posted April 28, 2008 What encoding is the database/table using? Link to comment https://forums.phpfreaks.com/topic/103227-solved-substring-special-characters/#findComment-528847 Share on other sites More sharing options...
azazel141 Posted April 28, 2008 Author Share Posted April 28, 2008 Solved it with the iconv. (utf- Link to comment https://forums.phpfreaks.com/topic/103227-solved-substring-special-characters/#findComment-528851 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.