[PHP] Identifying and removing ?line-return characters from MySQL search returns
Hi Everyone, My problem is not related to PHP itself, but I hope my solution is. I run a website with much of the material being fed from several MySQL databases. Some of the material is fed into the databases through a PHP mailbot and some directly uploaded from a FileMaker database on a desktop Mac. My problem is that when viewed using Safari on my Mac the search results show a lot of "unknown character" symbols (squares with diagonal crosses over them). This does not occur when MS Explorer is used. My workaround has been to convert the output to html and rely on the fact that the vast majority of site visitors use MS Explorer ... But I would really like to get rid of those characters. I had pretreated the text to replace ASCII 10 characters before uploading to MySQL (or so I thought) but I suspect my problem still relates to either ASCII 10, ASCII 13 or some other control character that is represented differently on the Mac and Windows browsers. It may be that the FileMaker text download puts ASCII 10 or something else back into the text ... this is not a problem for the content that is fed directly into the database by the PHP mailbot. This leads me to my two questions: 1. How can I determine what that invisible character is ... I'm guessing ASCII 10 (which I thought I'd removed) but don't know how to check; 2. How can I adjust my PHP code to 'treat' the MySQL output to remove that character on its way to the browser? I already use eregi and other string functions to cloak email addresses and otherwise clean-up the output ... but don't know how to find a (probably) control character such as this. I'm sorry if this is a very rudimentray, PHP 101, query ... but I am a pretty rudimentary coder. Cheers Dougal An example can be seen at (copy-paste works but clicking on the link doesn't seem to): http://aeromedical.org/List/archive_aeromed-list/archive_search_aeromed- list.php?form=yes&first_hit_on_page=0&query=%20SELECT%20datetime,%20auth or_email,%20title,%20body,%20author.person%20AS%20author_nameFROM%20`pos tings`,%20`author`%20%20WHERE%20(((body%20REGEXP%20'e')%20OR%20(title%20 REGEXP%20'e'))%20AND%20((YEAR(datetime)%20>=%20'1995')%20AND%20(YEAR(dat etime)%20<=%20'3000'))%20AND%20(postings.author_email%20=%20author.email )%20)%20ORDER%20BY%20datetime%20DESC%20%20LIMIT%200,%2010&count=963&sear chstring01=e&choice3=and&searchstring02=&choice4=and&searchstring03=&sta rtyear=1995&endyear=3000&show_full_posting=2006-01-24%2011:39:26 ... but it will look fine if you're using MS Explorer. This email and its accompanying attachments is intended for the named recipient only and may contain information that is confidential and subject to legal privilege. If you are not the intended recipient please inform the sender and destroy the message. If you have received this message in error you must not distribute or copy this email or its attachments. The Civil Aviation Authority accepts no responsibility for any changes made to this message after transmission from the Civil Aviation Authority. Before opening or using attachments, check them for viruses and other effects. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] RE: Hide email addresses from spam bots
> A user of mine insists that her email address shows on a web page. I need toprotect that address from spam bots. There are lots of solutions around thatI have come acros. I am looking for a clean, reusable, non-_javascript_solution. I don't know if it's what you're looking for but on some of my sites I use a small graphic "@" symbol. I then use eregi_replace to identify email addresses and insert the appropriate html tag so that the text @ is replaced by the image @. This is very simple and does not provide a click-to-email link ... which would require development in a slightly different direction ... but it does provide the reader with the look-and-feel of an email address without the ease of harvest that a true address provides. Of course, also, you cannot copy the text and paste it into your mailer ... you end-up with no @ at all. Cheers Dougal This email and its accompanying attachments is intended for the named recipient only and may contain information that is confidential and subject to legal privilege. If you are not the intended recipient please inform the sender and destroy the message. If you have received this message in error you must not distribute or copy this email or its attachments. The Civil Aviation Authority accepts no responsibility for any changes made to this message after transmission from the Civil Aviation Authority. Before opening or using attachments, check them for viruses and other effects. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Identifying and removing ?line-return characters from MySQL search returns
Thanks Richard, > Microsoft Word (and others) use non-ASCII characters for all kinds ... Most of the text passes from MS Entourage to FileMaker so that is, indeed, a possible source. I suspect the range of offending characters probably isn't that wide as they mostly coincide with locations where I'd anticipate line ends / carriage returns. There are certainly some contributions using non-English characters but not an awful lot of them. > http://php.net/htmlentities has several User Contributed notes ... Yes, I've been there and had htmlentities incorporated into previous versions. Perhaps time to revisit. > The best way to deal with this is to make EVERYTHING be UTF-8 from beginning to end. Not exactly the simple solution I was hoping for ... but great clarification that my problem may not be as simple as I'd hoped. I am very happy now that I've only uploaded a thousand or so rows to that particular database. I will follow-up on that info and, I suspect, update my site to UTF-8. Thanks very much for your ideas. Cheers Dougal This email and its accompanying attachments is intended for the named recipient only and may contain information that is confidential and subject to legal privilege. If you are not the intended recipient please inform the sender and destroy the message. If you have received this message in error you must not distribute or copy this email or its attachments. The Civil Aviation Authority accepts no responsibility for any changes made to this message after transmission from the Civil Aviation Authority. Before opening or using attachments, check them for viruses and other effects. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php