From 987299b45a017c9a4b5896703a865c1525bfcfcb Mon Sep 17 00:00:00 2001 From: "Pierre Habouzit (MadCoder" Date: Tue, 24 May 2005 10:48:52 +0000 Subject: [PATCH] new tests wrt encodings git-archimport-id: opensource@polytechnique.org--2005/banana--mainline--1.0--patch-24 --- banana/banana.inc.php.in | 4 ++-- banana/misc.inc.php | 6 +++--- banana/post.inc.php | 3 +-- po/banana.pot | 2 +- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/banana/banana.inc.php.in b/banana/banana.inc.php.in index 081c6cd..287bb66 100644 --- a/banana/banana.inc.php.in +++ b/banana/banana.inc.php.in @@ -228,7 +228,7 @@ class Banana $cuts = displayshortcuts(); $html = '

'._b_('Nouveau message').'

'.$cuts; - $html .= '
'; + $html .= ''; $html .= ''; $html .= ''; $html .= ''; @@ -238,7 +238,7 @@ class Banana $html .= ''; $html .= ''; $html .= ''; + .to_entities($body).($this->profile['sig'] ? "\n\n-- \n".htmlentities($this->profile['sig']) : '').''; $html .= '
'._b_('En-têtes').'
'._b_('Nom').''.htmlentities($this->profile['name']).'
'._b_('Organisation').''.$this->profile['org'].'
'._b_('Corps').'
'; if ($id > 0) { $html .= ''; diff --git a/banana/misc.inc.php b/banana/misc.inc.php index 41a37ba..9510b14 100644 --- a/banana/misc.inc.php +++ b/banana/misc.inc.php @@ -13,9 +13,9 @@ function _b_($str) { return utf8_decode(dgettext('banana', utf8_encode($str))); } -function to_html($str, $charset) { +function to_entities($str) { require_once 'banana/utf8.php'; - return utf8entities(htmlentities(iconv($charset, 'utf8', $str), ENT_NOQUOTES, 'UTF-8')); + return utf8entities(htmlentities($str, ENT_NOQUOTES, 'UTF-8')); } /******************************************************************************** @@ -206,7 +206,7 @@ function wrap($text, $_prefix="") } function formatbody($_text) { - $res = "\n\n" . wrap($_text, "")."\n\n"; + $res = "\n\n" . to_entities(wrap($_text, ""))."\n\n"; $res = preg_replace("/(<|>|")/", " \\1 ", $res); $res = preg_replace('/(["\[])?((https?|ftp|news):\/\/[a-z@0-9.~%$£µ&i#\-+=_\/\?]*)(["\]])?/i', "\\1\\2\\4", $res); $res = preg_replace("/ (<|>|") /", "\\1", $res); diff --git a/banana/post.inc.php b/banana/post.inc.php index 60f2986..ae71489 100644 --- a/banana/post.inc.php +++ b/banana/post.inc.php @@ -44,8 +44,7 @@ class BananaPost } if (preg_match('!charset=([^;]*)\s*(;|$)!', $this->headers['content-type'], $matches)) { - require_once 'banana/misc.inc.php'; - $this->body = to_html($this->body, $matches[1]); + $this->body = iconv($matches[1], 'utf-8', $this->body) } } diff --git a/po/banana.pot b/po/banana.pot index 79ffa3e..7cd3e86 100644 --- a/po/banana.pot +++ b/po/banana.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2005-05-24 10:50+0200\n" +"POT-Creation-Date: 2005-05-24 12:48+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" -- 2.1.4