hello,
Jiena l-ittestjar fuq forum test tiegħi (fil- ma UTF) u ma nistax jiġi riprodott imma inti tista 'tipprova din is-soluzzjoni.
Għandi xi ħaġa għalik:
1. miftuħa, tagħmel kopja u jeditjaw dan il-fajl:
/ għerq forum jinkludi / vbenterprisetranslator_functions_utils.php
2. f'dan il-funzjoni ssib:
PHP Code:
function vbet_encodeToSafeUTF8(&$string) {
//TODO how to check does utf-8 is involved? how often this function is used?
// if (! ereg('[\200-\237]', $string) and ! ereg('[\241-\377]', $string))
// if (!preg_match('/[\200-\237]/', $string) and !preg_match('/[\241-\377]/', $string))
// if (!preg_match('/[\200-\237\241-\377]/e', $string))
// return $string;
// decode three byte unicode characters
$string = preg_replace('/([\340-\357])([\200-\277])([\200-\277])/e',
'\'&#\'.((ord(\'\\1\')-224)*4096 + (ord(\'\\2\')-128)*64 + (ord(\'\\3\')-128)).\';\'',
$string);
//decode two byte unicode characters
$string = preg_replace('/([\300-\337])([\200-\277])/e',
'\'&#\'.((ord(\'\\1\')-192)*64+(ord(\'\\2\')-128)).\';\'',
$string);
return $string;
}
3. u jikkummentaw linji kollha mingħajr ritorn bħal dan wieħed:
PHP Code:
function vbet_encodeToSafeUTF8(&$string) {
//TODO how to check does utf-8 is involved? how often this function is used?
// if (! ereg('[\200-\237]', $string) and ! ereg('[\241-\377]', $string))
// if (!preg_match('/[\200-\237]/', $string) and !preg_match('/[\241-\377]/', $string))
// if (!preg_match('/[\200-\237\241-\377]/e', $string))
// return $string;
// decode three byte unicode characters
// $string = preg_replace('/([\340-\357])([\200-\277])([\200-\277])/e',
// '\'&#\'.((ord(\'\\1\')-224)*4096 + (ord(\'\\2\')-128)*64 + (ord(\'\\3\')-128)).\';\'',
// $string);
//decode two byte unicode characters
//$string = preg_replace('/([\300-\337])([\200-\277])/e',
// '\'&#\'.((ord(\'\\1\')-192)*64+(ord(\'\\2\')-128)).\';\'',
// $string);
return $string;
}
4. issalva u test!
dan għandu jaħdem biss għal postijiet ġodda. il-postijiet kollha eżistenti għandek jeditjaw bl-idejn.
Jien ma shure li għandek ISO forum imma int tista 'tittestja. Jekk le tajba - jekk jogħġbok jissostitwixxu dawn il-fajl bu bidliet qodma