Checks for invalid UTF8 in a string. This can be one step in sanitizing input data. For complete sanitizing, including checking for valid UTF8, use one of the sanitize_*() functions.
<?php $string = wp_check_invalid_utf8( $string, $strip ); ?>
<?php $string = wp_check_invalid_utf8( $_POST['description'], true ); if ( '' == $string ) die('Your description text used an invalid charset, it must be UTF8'); ?>
The source code comments suggest that actually stripping invalid characters is not recommended. Uses the PHP iconv module which may not be available on some installations.
Since: 2.8.0
wp-includes/formatting.php