/** * This safely converts an iso-8859 string into an utf-8 encoded * string. It does not convert when the string is already utf-8 encoded * * @param string $text iso-8859 encoded text * @param string $charset This is a k.o.-Argument. If it is NOT equal to 'utf-8', no conversion will take place * @return string */ function safe_utf8_encode($text, $charset) { if (strtolower($charset) == 'utf-8' && !vmAbstractLanguage::seems_utf8($text)) { // safely decode and reencode the string $text = utf8_encode($text); } // This converts the currency symbol from HTML entity to the utf-8 symbol // example: € => € $text = vmHtmlEntityDecode($text, null, vmGetCharset()); return $text; }