X-Git-Url: http://git.cyclocoop.org/?p=lhc%2Fweb%2Fwww.git;a=blobdiff_plain;f=www%2Fplugins-dist%2Fporte_plume%2Faction%2Fporte_plume_previsu.php;h=f1e8ed02ff764580d49a8f76618fb1fabebe7ce4;hp=875ef86e5b26b8e887be2d1bc8f77ee5c8635970;hb=122c920eb07e3f665789f8734965b576e6c25515;hpb=226942065cd4f604eb464addf45a065c9e5bc916 diff --git a/www/plugins-dist/porte_plume/action/porte_plume_previsu.php b/www/plugins-dist/porte_plume/action/porte_plume_previsu.php index 875ef86e..f1e8ed02 100644 --- a/www/plugins-dist/porte_plume/action/porte_plume_previsu.php +++ b/www/plugins-dist/porte_plume/action/porte_plume_previsu.php @@ -31,6 +31,32 @@ function action_porte_plume_previsu_dist() { if (!autoriser('previsualiser','porteplume')) $contexte = array(); + header('Content-type: text/html; charset='.pp_charset()); echo recuperer_fond('prive/porte_plume_preview', $contexte); } + +/** + * Retourner le charset SQL + * + * Retourne le charset SQL si on le connait, en priorité + * sinon, on utilise le charset de l'affichage HTML. + * + * Cependant, on peut forcer un charset donné avec une constante : + * define('PORTE_PLUME_PREVIEW_CHARSET','utf-8'); + * + * @return string Nom du charset (ex: 'utf-8') + */ +function pp_charset() { + if (defined('PORTE_PLUME_PREVIEW_CHARSET')) { + return PORTE_PLUME_PREVIEW_CHARSET; + } + + $charset = $GLOBALS['meta']['charset']; + $charset_sql = isset($GLOBALS['charset_sql_base']) ? $GLOBALS['charset_sql_base'] : ''; + if ($charset_sql == 'utf8') { + $charset_sql = 'utf-8'; + } + return $charset_sql ? $charset_sql : $charset; +} + ?>