/** * Converts a string to the desired character set if possible. Wrapper for the callback * @param string * @param string Character to convert to * * @return string Character in desired character set or as an HTML entity */ public static function convertStringToCurrentCharset($string) { return preg_replace_callback('/&#([0-9]+);/i', function ($matches) { return vB_String::convertUnicodeCharToCharset($matches[1], vB_String::getCharset()); }, $string); }