rm wrote:
> php3.x
>
> We have a large number of people submitting a large
> number of docs...I'm having a problem with some docs
> coming through with high ascii characters in the text,
> apparently the dbm database we're using chokes on some
> high ascii chars. I need to eliminate characters in
> the text from 122 to 255. I can't seem to find a
> simple way to do this....I have a routine, it works
> but it takes too long, something like;
>
> for ($i=122; $i<256; $i++){
>
> $textline=str_replace(chr($i),'',$textline)
>
> }
>
>
> Anyone know of a better, faster way to filter out
> these high ASCII characters
Hi!
Your best option is probably GNU Recode (see the PHP manual and
http://www.gnu.org/directory/recode.html)
It will allow you to convert 8-bit characters to a 7-bit characters
quickly and sanely: converting accented characters to their closest
logical equivalent.
Note: The method you chose is surprisingly speedy - it is a good 3-4
times faster than most other methods that are similar. However
your fastest method for removing the offending characters would be to
use preg_replace() - it should be about 4 times faster than the method
you chose.
--zak
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]