Remove †And Other Strange Variables in PHP?

I just created a feed reader and it has a tendency to pick up strange variables such as â€.

I’ve tried using the php str_replace to remove it but for some reason it does not.

Is there an easy operation to remove these?

A couple others:

There is that strange box one too. How can I clean from strings/txt?


The “strange characters” are a result of getting bytes in one character-encoding and showing them in another. Try the iconv function or replacing the characters based on their ord() values. If you want to see my example code :google: “widgets.php Hack” for iconv() and “comment-template Hack” for ord()

You’ll need to convert feed content to your target charset (from utf-8) or convert your page to utf-8.

I tried this with no success:


Would that work? Can I worry about converting the information once it is in my database?


since my page’s content is content=“text/html; charset=iso-8859-1”

I need to convert from whatever char to iso-8859-1, right?

I tried

iconv("UTF-8", "ISO-8859-1", $news['description'])

With no success.

So I guess my two questions are:

Is that conversion what I’m supposed to be doing? And, since it didn’t work on the echo, does it have to take place before database insertion?

You’d be looking for on the feeds.

It may be because that the feeds contain characters outside of iso-8859-1’s range.

Yeah. I got it to work. I had to use iconv before adding the content to the database.

We’ll see how it goes.


Props dude, just what I was looking for!