Replace extended ascii characters

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I've some text with some extended ascii characters like ¿ or ¡ and I
wanna replace these characters for blanks, but when I use the function
str_replace, it returns an invalid string, so I think that php cannot
detect these kind of characters and of course, it cannot replace them.

I've already tried to use mb_ereg_replace, but it doesn´t work. Has
anybody any idea how can I get a solution for this problem?

Thanks in advance!

Re: Replace extended ascii characters

Have you tried using the str_replace with the chr function.  Something
like: str_replace(chr(168), ' ', $str);

There is also a function that a user submitted on this PHP manual page
that replaces all non-readable characters with a '.', you could change
it to make it a blank and it might work exactly for your needs.

Re: Replace extended ascii characters

I've found a solution. str_replace works right, but the problem was
that I get the string from a database and it seems that it was an
strange character (ascii 194), that had to be next to ¡ or ¿ (ascii
161 and 191), I don't know why, but....

Now, to replace the ¡ and ¿, I must use

Site Timeline