How in this example I can encode text from MySQL?
This is how the text look like in MySQL using utf8mb4_unicode_ci
:
$text = 'Wiesław';
I have tried so far:
header("Content-Type: text/html; charset=ISO-8859-1");
echo htmlentities($text);
echo '</br>';
echo html_entity_decode($text);
echo '</br>';
echo htmlspecialchars_decode($text);
echo '</br>';
echo htmlspecialchars_decode($text, ENT_NOQUOTES);
echo '</br>';
echo utf8_encode($text);
echo '</br>';
echo utf8_decode($text);
echo '</br>';
echo mb_convert_encoding($text, 'ISO-8859-1', 'UTF-8');
echo '</br>';
echo iconv('UTF-8', 'ISO-8859-1', $text);
echo '</br>';
echo mb_convert_encoding($text, 'UTF-8', 'ISO-8859-1');
Results:
Wies³aw
Wies³aw
Wies³aw
Wies³aw
Wies³aw
Wies?aw
Wies?aw
Wies³aw
Expectation:
Wiesław