Re: triming utf8 (?) a string

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jul 09, 2007 at 07:45:10AM -0700, Jim Lucas wrote:
> Rick Pasotto wrote:
> >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?
> 
> Nope, not confused, but I ASSUMED that maybe the chars were not at the 
> beginning or ending of the string, but somewhere in the middle.  ( you 
> didn't say where the chars were )

Yes, I did. "the original *plus* some '\ufffd' bytes" clearly means that
they were added at the end.

> And since you were using trim(), that you were using the wrong function.  
> Which only works on the beginning and ending of a string.

I wanted to remove the characters that were added at the *end* of the
string.

-- 
"Blaming 'society' makes it awfully easy for a person of weak character
 to shrug off his own responsibility for his actions." -- Stanley Schmidt
    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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux