- mb_convert_encoding: documentation ( source)
- htmlentities: documentation ( source)
- htmlspecialchars: documentation ( source)
<?php
$text = mb_convert_encoding('asdf&ddddd"fancy˝quotes˝', 'UTF-7', 'UTF-8');
echo htmlspecialchars($text, ENT_COMPAT | ENT_HTML401, 'UTF-8') . "\n";
// Output: asdf&ddddd"fancyË
echo htmlentities($text, ENT_COMPAT | ENT_HTML401, 'UTF-8') . "\n";
// Output: asdf&ddddd"fancyËquotes