Bug #5937 - Fix nonascii chars in graphs:

* text is converted to unicode - no html entities anymore
 * then all nonascii chars are converted to decimal number entites
 * default.ttf is searched in dataroot/lang and local language packs too
 * removed lang_decode() - obsoleded by proper entity converison above
 * updated documentation in lang/en_utf8/fonts/README.txt
This commit is contained in:
skodak
2006-06-29 21:19:10 +00:00
parent 0cf39f9160
commit 7c58698a8a
4 changed files with 55 additions and 40 deletions
+24
View File
@@ -231,5 +231,29 @@ class textlib {
return $encoded;
}
/**
* Converts all Unicode chars > 127 to numeric entities &#nnnn; or &#xnnn;.
*
* @param string input string
* @param boolean output decadic only number entities
* @param boolean remove all nonumeric entities
* @return string converted string
*/
function utf8_to_entities($str, $dec=false, $nonnum=false) {
/// Avoid some notices from Typo3 code
$oldlevel = error_reporting(E_PARSE);
if ($nonnum) {
$str = $this->typo3cs->entities_to_utf8($str, true);
}
$result = $this->typo3cs->utf8_to_entities($str);
if ($dec) {
$result = preg_replace('/&#x([0-9a-f]+);/ie', "'&#'.hexdec('$1').';'", $result);
}
/// Restore original debug level
error_reporting($oldlevel);
return $result;
}
}
?>