Reputation: 10056
Si i'm parsing a web page with a parser that i created..and when i parse the page and echo the content out I get characters like these â€
why is doing it that,it supposed to be ...
or any other character like --
instead.
Upvotes: 1
Views: 710
Reputation: 10056
I go this solved with iconv("UTF-8","ISO-8859-1",$string)
it does the job, 10x guys
Upvotes: 1
Reputation: 10350
Usually those type of characters come from bad character encoding. From the top of my head, your best solution is to check the web page that you created for the meta tag supplying character encoding on the webpage. Something like this:
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>
And making sure you supply the same character encoding on your end.
Upvotes: 3
Reputation: 26554
The weird characters are caused by encoding problems, your best bet is to encode them to UTF-8 (make sure your page is also in UTF-8) before you echo them.
You can use the function utf8_encode for that.
Here is a very complete answer on how to successfully do that: Detect encoding and make everything UTF-8
Upvotes: 6