Forum Moderators: coopster

Message Too Old, No Replies

php strip tag function leaving question marks

         

coastalguy

11:26 pm on Jun 14, 2008 (gmt 0)

10+ Year Member



I am pulling my blog posts from it's mysql database table, and extracting the code, from the text, using the strip_tag php function. However, a large number of question marks are appearing in the resulting text, although they are not there when viewing the page source. Looking at the original text in the blog admin page, and can't find any characters that would do this. I tried using the strtr function to remove "?" and replace it with " ", but it doesn't work (again as ? appear but are not in the text. Anyone have this problem and/or know of a solution to remove these characters.

henry0

12:09 pm on Jun 15, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



coastalguy, welcome to WebmasterWorld!

Is dreamW involved in this?
I have seen it while someone we hired (outsourced) used DW
I got rid of those by editing via Firefox
even my trusted UltraEdit did not see those question marks!

coastalguy

3:42 pm on Jun 15, 2008 (gmt 0)

10+ Year Member



HenryO,
No, these come from a MySql database entered through WordPress Posts. You advised you fixed these via FireFox? Can you be more explicit?
Thanks,

henry0

6:00 pm on Jun 15, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Do a view src, copy, paste in an editor
Firefox was able to see them, but not IE!

those question marks were before the <?php tag, so hanging to the page very top.

coastalguy

6:53 pm on Jun 15, 2008 (gmt 0)

10+ Year Member



henry0
Thanks...I do see them when I view source in Firefox (but not IE). My problem now is how do remove them so they do not view on the webpage? I have tried the function:
$content = strtr($content, "?", " ");
however this doesn't remove them, as this is supposed to do by replacing ? with a blank space ($content being the variable that I am echoing).

coastalguy

2:50 am on Jun 16, 2008 (gmt 0)

10+ Year Member



henry0,
Went back into my posts, and where question marks appeared on my webpage extracted from the php/mysql database post table, there were actually 2 or more "hard returns" or "spaces", even though they did not show. I deleted everything between the characters causing the question marks, and re-entered a spacebar or a single hard return, and the question marks disappeared. If I put in 2 spaces or 2 hard returns, a question mark re-appeared....very strange....any suggestions as to why this happens?

henry0

11:25 am on Jun 16, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have seen that once, but sorry cannot remember the reason for it

anyone?

found something interesting do a Google for:
php double space question mark

the first result has your answer, it's related to your blog application.

dreamcatcher

12:17 pm on Jun 16, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Its probably to do with the collation and character set of the database. What is your collation? Try utf8_unicode_ci.

dc

coastalguy

5:10 pm on Jun 16, 2008 (gmt 0)

10+ Year Member



dreamcatcher,
My database is set to the code you mentioned. Note that the posts display properly on the blog page through WordPress, but using php to open the database and display it, I get the ?'s. Again, I did find it involved double spaces, where the 2nd space produced the ?. WordPress forums covered this but not specific to php/mysql results. I would not have a problem as I only type one space, however the owner of the blog, typing the posts, sometimes uses 2. I'll just have to have her watch her typing.. Thanks again for all of your help.