remove line break characters

remove line break characters

It's only fair to share...Share on Facebook
Facebook
0Tweet about this on Twitter
Twitter
Email this to someone
email

preg_replace to get rid of those pesky line break characters.

Particularly for Google Maps bubble’s which take an aversion to non-ASCII chars so as to stop a map rendering altogether.

Non-ACSII characters
This piece of code should be applied when generating a Google Map using any quantity of user generated material.

function removelinebreaks($string)
{
return preg_replace(‘/[\r\n\t]/e’, ‘ ‘, $string);
}

Also make sure you trim your bubbles, and if you’re particularly nervous check the htmlentities and CDATA[ declarations also.

Makes for happier bubbles 🙂

(Visited 1 times, 1 visits today)

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *