Subversion Repositories eFlore/Applications.cel

Compare Revisions

Ignore whitespace Rev 605 → Rev 606

/trunk/jrest/services/InventoryImportExcel.php
844,7 → 844,7
}
 
function init_byte_map(){
global $byte_map;
$byte_map = array();
for($x=128;$x<256;++$x){
$byte_map[chr($x)]=utf8_encode(chr($x));
}
880,12 → 880,14
foreach($cp1252_map as $k=>$v){
$byte_map[$k]=$v;
}
return $byte_map;
}
 
function fix_latin($instr){
$byte_map=array();
init_byte_map();
$byte_map = init_byte_map();
$ascii_char='[\x00-\x7F]';
$cont_byte='[\x80-\xBF]';
$utf8_2='[\xC0-\xDF]'.$cont_byte;
892,6 → 894,7
$utf8_3='[\xE0-\xEF]'.$cont_byte.'{2}';
$utf8_4='[\xF0-\xF7]'.$cont_byte.'{3}';
$utf8_5='[\xF8-\xFB]'.$cont_byte.'{4}';
$nibble_good_chars = "@^($ascii_char+|$utf8_2|$utf8_3|$utf8_4|$utf8_5)(.*)$@s";
 
if(mb_check_encoding($instr,'UTF-8'))return $instr; // no need for the rest if it's all valid UTF-8 already