diff --git a/ecrire/xml/sax.php b/ecrire/xml/sax.php index e2b259ab274b191d08196091c6f6a9df5caf2866..9d0f25b134528288b7da861fdb56c518e785d8bc 100644 --- a/ecrire/xml/sax.php +++ b/ecrire/xml/sax.php @@ -185,7 +185,7 @@ function xml_sax_dist($page, $apply=false, $phraseur=NULL, $doctype='', $charset include_spip('xml/analyser_dtd'); $dtc = charger_dtd($grammaire, $avail, $rotlvl); - $page = sax_bug($page, $dtc); + $page = sax_bug($page, $dtc, $charset); // compatibilite Tidy espace public if (!$phraseur) { @@ -228,8 +228,11 @@ function xml_sax_dist($page, $apply=false, $phraseur=NULL, $doctype='', $charset // sinon on se rabat sur ce qu'en connait SPIP en standard. // http://doc.spip.org/@sax_bug -function sax_bug($data, $dtc) +function sax_bug($data, $dtc, $charset=null) { + if (is_null($charset)) + $charset = $GLOBALS['meta']['charset']; + if ($dtc) { $trans = array(); @@ -241,7 +244,7 @@ function sax_bug($data, $dtc) } else { $data = html2unicode($data, true); } - return unicode2charset($data); + return unicode2charset($data, $charset); } // Retirer < ? xml... ? > et autre PI, ainsi que les commentaires en debut