Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

control M (^M) characters in text

Status
Not open for further replies.

GeckoNZ

IS-IT--Management
Jul 23, 2001
31
0
0
I am extracting data from an MSSQL database and output to a pipe (|) delimited text file. However, I am getting "^M"
characters in my output file. I believe that this is because there must be carriage returns in on of the database fields.

How can I remove them? I have tried the strtr() function but am not sure how to correctly define the control character (^M) for replacement.
 
Found the answer ...
You can replace the carriage returns as follows :

$text = str_replace(chr(13),' ',$text)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top