There is a text UTF-8, it has a number of characters of the form

$bad_symbols = array('â', 'â','â','â'); 

Here the characters can not be inserted, here on the screen

"In life" on the site, these characters look like single or double quotes, dashes.

This is a popular topic, googled and found the answer https://stackoverflow.com/questions/2477452/%C3%A2%E2%82%AC-showing-on-page-instead-of , but I don’t understand how participants use tables like this, define the original encoding https://www.charset.org/utf-8 (what is the mechanics of action?)

I tried to transcode these characters, got them in the form (what a view, by the way?)

â = â

’ = â € ™

but what should I do with this next? How to understand the original encoding? And how to get rid of it, lead to a normal look? If it is impossible to bring to a normal mind, then at least how to determine all the lines with such characters, maybe there is some kind of hook? I now solve it manually, I find all such symbols and str_replace is a hellish crutch.

Also tried all possible options ICONV

 $z = 'Itâs a pity to cut beautiful curly hair. If itâs'; iconv('CP-1252','UTF-8',$z); iconv('windows-1252','UTF-8',$z); iconv('ISO-8859-1','UTF-8',$z); iconv('UTF-8','ISO-8859-1',$z); iconv('UTF-8','CP-1252',$z); iconv('UTF-8','windows-1252',$z); 

The result is always False, and nothing changes!

  • Look in the direction of the data source with these characters ... It is not possible to distinguish encodings on a small set of characters! Algorithms for encoding determination usually proceed from the fact that some characters in texts are more often others less often. UTF-8 is a character encoding with a dynamic character width, i.e., a character can be represented as 1 or 5 bytes, the rest of the encodings you provide are single byte. - fens
  • Converting through iconv will not help you in any way, because with the conversion of this symbol, you will get other characters in the line - fens
  • @fens "Look at the data source with these symbols ..." - and what can I see there? It says utf-8, and that's it. - wtfowned
  • where exactly? If you are talking about a database, then it is not in a specific context a data source. The source of the data curves for you is the place where these symbols came from in the database. - fens

0