remove line break characters
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 đ