Fallback for failed recoding added.

This commit is contained in:
tomash 2006-09-14 20:36:00 +00:00
parent 473c968cb3
commit 5d5d96f002
1 changed files with 4 additions and 1 deletions

View File

@ -128,7 +128,10 @@ function addMdata($key, $val, $iEnc='iso-8859-1'){
$oEnc = 'UTF-8';
if(function_exists('iconv') && $iEnc != $oEnc){
$data = $r = @iconv($iEnc, $oEnc, $data);
if($r === FALSE) die("Recoding metadata to unicode failed.");
if($r === FALSE){
echo "Warning: convert $key data to unicode failed\n";
$data = $val; // fallback
}
}
if($key == $titleKey) $titleHaveSet = TRUE;
$mdata[$key] = trim($data);