PHP 8.5.0 Alpha 1 available for testing

Voting

: one minus one?
(Example: nine)

The Note You're Voting On

powtac 4t gmx d0t de
14 years ago
I tried a lot of things, but this seems to be the final fail save method to convert any string to proper UTF-8.

<?php
function _convert($content) {
if(!
mb_check_encoding($content, 'UTF-8')
OR !(
$content === mb_convert_encoding(mb_convert_encoding($content, 'UTF-32', 'UTF-8' ), 'UTF-8', 'UTF-32'))) {

$content = mb_convert_encoding($content, 'UTF-8');

if (
mb_check_encoding($content, 'UTF-8')) {
// log('Converted to UTF-8');
} else {
// log('Could not converted to UTF-8');
}
}
return
$content;
}
?>

<< Back to user notes page

To Top