I have the following code:
mb_convert_encoding($string, 'HTML-ENTITIES', 'utf-8');
I need to have an alternative code which does exactly the same but does not use any mb_* functions (the mb extension is not available on some environments).
I thought that
utf8_decode(htmlentities($string, ENT_COMPAT, 'utf-8'));
should do exactly the same, but unfortunately it does not.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…