I'd like to convert character encoding of a string to HTML-ENTITIES and then back to utf-8. I thought that converting to some encoding and back should leave me with the same string, but it doesn't look like it.
My testing string is:
Test: ěščřžýáíé'
Conversion to HTML-ENTITIES
echo mb_convert_encoding('Test: ěščřžýáíé', 'HTML-ENTITIES', 'UTF-8');
outputs this result:
Test: ěščřžýáíé
However when I try to convert back to utf-8
echo mb_convert_encoding('Test: ěščřžýáíé', 'UTF-8', 'HTML-ENTITIES');
I surprisingly get (incorrect) ouput, not the original string:
Test: ěščřžýáĂĂ©
How can I properly convert encodings to get my original string back?