Reputation: 13204
I've got string:
$str = "Końcówki";
My target string is:
$str = "Końcówki";
echo html_entity_decode($d); // Końc�wki
echo utf8_encode(html_entity_decode($d)); // KoÅcówki
How to decode it without crashing other special chars?
Upvotes: 1
Views: 637
Reputation: 522175
The character needs to be decoded into some charset. The string already contains a character which is encoded in a specialized charset. You need to tell html_entities_decode
to decode to that same charset. At the moment there's a mismatch between the two.
html_entity_decode($str, ENT_COMPAT, 'your charset here')
Upvotes: 2