Gooner Posted September 25, 2006 Share Posted September 25, 2006 HiI have a field in a MySQL database that reads: "abcde:1 bag - £" (without the quotes)I am returning this value (which is stored as text in the database) as follows:I split the result into an array, using the : as the delimiter.So, $array[0] = "abcde" and $array[1] = "1 bag - £"The problem I have is that when I echo the $array[1] value i get the following displayed:1 Bag - £Where does this  come from, and how can I not display it?Thanks for your help. Quote Link to comment Share on other sites More sharing options...
aliendisaster Posted September 25, 2006 Share Posted September 25, 2006 What collation are you using on this field? This could be causing the  to display.You can try changing the collation on this field and see if that removes the character.Another way to remove it would be to use str_replace to remove it like so:[code]echo str_replace('Â', '', $array[1])[/code] Quote Link to comment Share on other sites More sharing options...
fenway Posted September 25, 2006 Share Posted September 25, 2006 I does sound like a character set issue... Quote Link to comment Share on other sites More sharing options...
Gooner Posted September 26, 2006 Author Share Posted September 26, 2006 The page is using "charset=iso-8859-1".The str_replace does solve the problem (although I can't actually type the Â, I have to copy & paste it).The field is set to "text" in the database.Any other suggestions, as I'd rather not use the str_replace option.Thanks Quote Link to comment Share on other sites More sharing options...
fenway Posted September 26, 2006 Share Posted September 26, 2006 Not the page, the table. Quote Link to comment Share on other sites More sharing options...
AndyB Posted September 26, 2006 Share Posted September 26, 2006 I wonder is it's some word processing wizardry involving something "smart" or an en-dash, etc. Quote Link to comment Share on other sites More sharing options...
fenway Posted September 26, 2006 Share Posted September 26, 2006 Yeah, MS Word does that all the time to "smart quotes" -- drives me nuts. Quote Link to comment Share on other sites More sharing options...
Gooner Posted September 27, 2006 Author Share Posted September 27, 2006 Thanks for your replies.I ahve checked the charset on the table using phpMyAdmin and it states it's using English - iso-8859-1.I'm not sure what you mean about the word processing issues. This database has never been near one and none of the values come from word (they were actually manually entered into the database). Quote Link to comment Share on other sites More sharing options...
Gooner Posted September 27, 2006 Author Share Posted September 27, 2006 Aha... sussed it thanks.Navicat, a program I use to edit the database, DIDN'T have the right charset. I have now put it right and everything is fine.Thanks for your help. Quote Link to comment 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.