1

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.

hakre
  • 193,403
  • 52
  • 435
  • 836
Uffo
  • 9,628
  • 24
  • 90
  • 154
  • did you save it in a weird character set or not send the correct headers? – zzzzBov Apr 07 '11 at 21:56
  • 1
    and the code for the parser is???? we are not magic. we cant read ur computer screen like -- **poof** ooo so thats how u did it – Naftali Apr 07 '11 at 21:56
  • I think it's a character encoding issue. See http://www.phpwact.org/php/i18n/charsets – Adam Apr 07 '11 at 21:57

3 Answers3

6

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

Community
  • 1
  • 1
amosrivera
  • 26,114
  • 9
  • 67
  • 76
3

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.

Khez
  • 10,172
  • 2
  • 31
  • 51
1

I go this solved with iconv("UTF-8","ISO-8859-1",$string) it does the job, 10x guys

Uffo
  • 9,628
  • 24
  • 90
  • 154