Re: Removing strange chars from array (or string)

From: Date: Wed, 15 Sep 2004 15:53:21 +0000
Subject: Re: Removing strange chars from array (or string)
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-196747@lists.php.net to get a copy of this message
> From: "Zoran Lorkovic" <zoky@unreal-net.com> > > > 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). > [snip] > > Am I missing something? > > You forgot to post your code. If you're only using \n for newlines, Notepad > won't recognize them (it's expecting \r\n) and will mess up your layout. Ok, here is one piece of code dealing with this: $data[0] = preg_replace("/([<])+([^>])+([.])*([>])+/i","", $data[0]); $data[0] = str_replace ("&nbsp", "", $data[0]); $file = fopen ("data.txt", "wb"); fwerite ($file, $data[0]); flocse ($file); As you see, I'm not using any \n for new lines because this code deals with HTML page. I guess problem is in new line, and trim() only cuts whitespaces. Regards. Zoran

« previous php.general (#196747) next »