On Sun, Jul 08, 2007 at 06:30:54PM -0700, Jim Lucas wrote: > Rick Pasotto wrote: > >I'm using the PEAR Crypt_Blowfish module. When I decrypt the encrypted > >string the result is the original plus some '\ufffd' bytes. How can I > >get rid of those extra bytes? I've tried both trim($x,'\ufffd') and > >trim($x,utf8_decode('\ufffd')). > > > trim() is meant to remove chars from the beginning and ending of a string. > > http://us2.php.net/str_replace is meant to remove a set of chars from a > string. Anywhere within the string. But it *is* a single char that I'm wanting to remove (multiple times). Perhaps you are confusing a char with a byte? Anyway, the problem is solved from the other end. So long as the original string has a length that is a multiple of 8 the encoded/decoded result has no extra chars. Padding the initial string with spaces makes it easy to then trim() the output. -- "The care of every man's soul belongs to himself. But what if he neglect the care of it? Well what if he neglect the care of his health or his estate, which would more nearly relate to the state. Will the magistrate make a law that he not be poor or sick? Laws provide against injury from others; but not from ourselves. God himself will not save men against their wills." -- Thomas Jefferson 1776-10 Rick Pasotto rick@xxxxxxxx http://www.niof.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php