wml <br /> and \n
Posted: Wed Mar 31, 2004 9:59 am
Hi there
I have a function which takes my wml string and converts all <br/> to \n:
function br2nl($string) {
$br = array('<br/>','<br />','<BR>','<BR/>','<BR />');
return str_replace($br,'\n',$string);
}
It seems to work fine when I do the following
$string = "This <br/> is my <br/> string";
echo br2nl($string);
//returns "This \n is my \n string"
When however I mail this string with phpmailer to a sms server the output that I get via sms is "This/n is my /n string".
I've tested:
$string = This \n is my \n string"
and it works fine. So somewhere in the string that my br2nl function returns thre must be special characters which mess up my mail.
Any suggestions on how to see what all the special characters are and how to remedy this?
Regards
swartbees
I have a function which takes my wml string and converts all <br/> to \n:
function br2nl($string) {
$br = array('<br/>','<br />','<BR>','<BR/>','<BR />');
return str_replace($br,'\n',$string);
}
It seems to work fine when I do the following
$string = "This <br/> is my <br/> string";
echo br2nl($string);
//returns "This \n is my \n string"
When however I mail this string with phpmailer to a sms server the output that I get via sms is "This/n is my /n string".
I've tested:
$string = This \n is my \n string"
and it works fine. So somewhere in the string that my br2nl function returns thre must be special characters which mess up my mail.
Any suggestions on how to see what all the special characters are and how to remedy this?
Regards
swartbees