Page 1 of 1

Need help removing something from text file

Posted: Sun Oct 02, 2005 3:17 am
by Extremest
I have a big text file with a bunch of words in it for my db. Problem is somehow it got some squares in the text from one of the files. I have copied the square itself and put it in my replace array but yet it don't get removed. Was wondering if anyone knows what it is. I tried removing \r thinking maybe that was it but was wrong. Help is definately needed.

Posted: Sun Oct 02, 2005 6:50 am
by feyd
they are likely binary characters outside the character set of the font you are using.

Posted: Sun Oct 02, 2005 11:11 am
by Extremest
Is there anyway to get rid of them? If I do a replace with them to a space and save the file they come right back. I don't quite understand that.

Posted: Sun Oct 02, 2005 11:40 am
by Extremest
ok It might be the extended chars from 128 up. I noticed a few of them in there from that block. Now using preg_replace how do I setup and array to for the search for those. I am not sure how I have to setup the expression. I have been using str_replace.

Posted: Sun Oct 02, 2005 11:56 am
by Extremest
ok I think I have it now using this.

Code: Select all

$new_data = ereg_replace("[^A-Za-z0-9]", "", $data);