public static function PHPUnit_Util_String::convertToUtf8 in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/phpunit/phpunit/src/Util/String.php \PHPUnit_Util_String::convertToUtf8()
Converts a string to UTF-8 encoding.
Parameters
string $string:
Return value
string
3 calls to PHPUnit_Util_String::convertToUtf8()
- PHPUnit_Util_Log_JSON::write in vendor/
phpunit/ phpunit/ src/ Util/ Log/ JSON.php - PHPUnit_Util_Log_JSON::writeCase in vendor/
phpunit/ phpunit/ src/ Util/ Log/ JSON.php - PHPUnit_Util_XML::prepareString in vendor/
phpunit/ phpunit/ src/ Util/ XML.php - Escapes a string for the use in XML documents Any Unicode character is allowed, excluding the surrogate blocks, FFFE, and FFFF (not even as character reference). See http://www.w3.org/TR/xml/#charsets
File
- vendor/
phpunit/ phpunit/ src/ Util/ String.php, line 24
Class
- PHPUnit_Util_String
- String helpers.
Code
public static function convertToUtf8($string) {
if (!self::isUtf8($string)) {
if (function_exists('mb_convert_encoding')) {
$string = mb_convert_encoding($string, 'UTF-8');
}
else {
$string = utf8_encode($string);
}
}
return $string;
}