Re: Removing strange chars from array (or string)

From: Date: Wed, 15 Sep 2004 14:41:39 +0000
Subject: Re: Removing strange chars from array (or string)
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-196737@lists.php.net to get a copy of this message
Zoran Sounds like your problem is with line endings - your unix (i presume) box ends its lines with a newline (\n) Windows ends lines with a carraige return followed by a newline (\r\n or CRLF) Notepad doesn't recognise a newline on its own as either a valid character or a valid line ending, so it displays it as a box Wordpad is slightly cleverer from the sound of things, and correctly interprets your newline characters trim() probably won't help because it only trims whitespace from the ends of the string - it won't strip it from the middle if you're building up your output line by line, try trim()ming it line by line otherwise you might want to look into regexes to strip repeated newlines Cheers chris Zoran Lorkovic wrote:
Hi Well, when parsing html page data I want to save is saved in txt file. But when saving in txt file I got some strange chars like small square (this I see when open in NotePad). When I try to open in WordPad this strange chars (squares) are recognized as new lines so in my file I got many empty lines. I've try to trim array (string) before saving to file but that didn't help (tried with trim, ltrim and rtrim). Am I missing something? Regards, Zoran


« previous php.general (#196737) next »