ob_iconv_handler():
<?php
// Output text as-is
echo 'blåbærøl', "<br/>\n";
// Set the output and internal encodings
iconv_set_encoding("output_encoding", "utf-8");
iconv_set_encoding("internal_encoding", "iso-8859-1");
// Start the output buffer handler and echo the string again
ob_start("ob_iconv_handler");
echo 'blåbærøl', "<br/>\n";
ob_end_flush();
// Change the internal encoding
iconv_set_encoding("internal_encoding", "iso-8859-2");
// Start the output buffer handler and echo the string again
ob_start("ob_iconv_handler");
echo 'blåbærøl', "<br/>\n";
ob_end_flush();
?>
Output:
blåbærøl
blåbærøl
blåbærøl
blåbærøl
blåbærøl