Hello all,
I have just found that some \r
newline characters are getting into the comment field of a table.
This is what I am seeing from a display of the field: Ο\r
\r
Π
I have been testing different variations of the following code but it doesn’t seem to work.
$msgtxt = $row["msgtxt"];
$bad = array('/^\\r\
*/', "\\r\
", "\ ", "\
", "\\r");
$msgtxt = str_replace($bad, " ", $msgtxt);
$msgtxt = preg_replace("/n[\\r\
]/", " ", $msgtxt);
$msgtxt = preg_match_all("~\\s[\ |\\r|\
]~", " ", $msgtxt);
$msgtxt = str_replace("\\r", " ", $msgtxt);
$msgtxt = str_replace("\
", " ", $msgtxt);
$msgtxt = preg_replace("~\\r~", " ", $msgtxt);
$msgtxt = preg_replace("~\
~", " ", $msgtxt);
First of all, I am trying to figure out how they got into the field while at the same time trying to get this to work to use in the following function.
function remove_headers($string) {
$headers = array( "/to\\:/i", "/from\\:/i", "/bcc\\:/i", "/cc\\:/i", "/Content\\-Transfer\\-Encoding\\:/i", "/Content\\-Type\\:/i",
"/Mime\\-Version\\:/i" );
$string = preg_replace($headers, '', $string); return strip_tags($string);
} // end function
Anyone have any possible solutions?