0

I have been struggling for a while to find any resources on how to remove this strange question mark square symbol: �

Standard str_replace and preg_match don't work. Can anybody assist in this? Settings the charset header('Content-Type: text/html; charset=utf-8') doest not work either. Nor does:ini_set("default_charset", 'utf-8');

I should mention I am using curl to request the data from a webpage.

Thanks

Nebula
  • 679
  • 2
  • 17
  • 37
  • Are you using UTF-8 encoding on page? – Alok Patel Jul 05 '16 at 13:08
  • This symbol is just something that your navigator cannot interpret. Put your page in utf-8 and everything should be fine – Hearner Jul 05 '16 at 13:09
  • [What Every Programmer Absolutely, Positively Needs To Know About Encodings And Character Sets To Work With Text](http://kunststube.net/encoding/), [Handling Unicode Front To Back In A Web App](http://kunststube.net/frontback/) – deceze Jul 05 '16 at 13:12
  • Sorry guys I forgot to mention ini_set("default_charset", 'utf-8'); also does not work.. – Nebula Jul 05 '16 at 13:23
  • Neither does . – Nebula Jul 05 '16 at 13:25
  • We have nowhere near enough information to help you. 1) What data are you talking about? Where does that data come from? What encoding does it have? 2) Where are you trying to display that data and how? 3) Are you doing anything with the data inbetween; conversion, manipulation or anything else? – deceze Jul 05 '16 at 13:31
  • 1) HTML page, Simple curl to google search and return the first result (All HTML). 2) Echo this data right out on webpage after request. 3) I am trying to remove the symbol in between. – Nebula Jul 05 '16 at 13:41
  • That random external website could be in any possible encoding. You have to pay attention to the encoding HTTP headers and convert the encoding accordingly to the encoding you expect. If you don't want to reinvent the wheel here, use a more full featured library which can handle all that automatically can give you the result in your desired encoding. – Read the articles I linked to above is this is all gibberish to you, you need to understand some basics about encodings. – deceze Jul 05 '16 at 14:10

0 Answers0