function ISO_decode($chaine) { global $charset; $encodage_fic_source = $_SESSION["encodage_fic_source"]; //On a forcé l'encodage au moment de l'import ou de la convertion if ($encodage_fic_source == "iso8859") { if ($charset !== 'utf-8') { //Le charset de PMB est en iso-8859 return $chaine; } else { return utf8_encode($chaine); } } elseif ($encodage_fic_source == "iso5426") { if (is_object($this)) { $chaine = $this->ISO_646_5426_decode($chaine); } else { $chaine = iso2709_record::ISO_646_5426_decode($chaine); } if ($charset !== 'utf-8') { //Le charset de PMB est en iso-8859 return $chaine; } else { return utf8_encode($chaine); } } elseif ($encodage_fic_source == "utf8") { //On regarde si il y a les NSBB NSBE if (preg_match("/^" . chr(0xc2) . chr(0x98) . "(.*?)" . chr(0xc2) . chr(0x9c) . "(.*)\$/s", $chaine, $matches)) { if (count($matches) == 3 && trim($matches[1]) && trim($matches[2])) { $chaine = $matches[1] . $matches[2]; } } if ($charset !== 'utf-8') { //Le charset de PMB est en iso-8859 return utf8_decode($chaine); } else { return $chaine; } } if (is_object($this) && $this->is_utf8 === TRUE) { //Cas notices USMARC et UNIMARC encodees en UTF8 //On regarde si il y a les NSBB NSBE if (preg_match("/^" . chr(0xc2) . chr(0x98) . "(.*?)" . chr(0xc2) . chr(0x9c) . "(.*)\$/s", $chaine, $matches)) { if (count($matches) == 3 && trim($matches[1]) && trim($matches[2])) { $chaine = $matches[1] . $matches[2]; } } if ($charset !== 'utf-8') { $chaine = utf8_decode($chaine); } return $chaine; } if (is_object($this)) { $chaine = $this->ISO_646_5426_decode($chaine); } else { $chaine = i_2709::ISO_646_5426_decode($chaine); } if ($charset == 'utf-8') { $chaine = utf8_encode($chaine); } return $chaine; }