From 039fee5795aa76ba12beff9b8b3e7489c3ea381e Mon Sep 17 00:00:00 2001 From: tokul Date: Wed, 10 Nov 2004 17:38:58 +0000 Subject: [PATCH] special chars should be undone only after encoding git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@8361 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/i18n.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/functions/i18n.php b/functions/i18n.php index 58395b5c..eb213859 100644 --- a/functions/i18n.php +++ b/functions/i18n.php @@ -157,11 +157,6 @@ function charset_decode ($charset, $string) { function charset_encode($string,$charset,$htmlencode=true) { global $default_charset; - // Undo html special chars - if (! $htmlencode ) { - $string = str_replace(array('&','>','<','"'),array('&','>','<','"'),$string); - } - $encode=fixcharset($charset); $encodefile=SM_PATH . 'functions/encode/' . $encode . '.php'; if (file_exists($encodefile)) { @@ -171,6 +166,16 @@ function charset_encode($string,$charset,$htmlencode=true) { include_once(SM_PATH . 'functions/encode/us_ascii.php'); $ret = charset_encode_us_ascii($string); } + + /** + * Undo html special chars, some places (like compose form) have + * own sanitizing functions and don't need html symbols. + * Undo chars only after encoding in order to prevent conversion of + * html entities in plain text emails. + */ + if (! $htmlencode ) { + $ret = str_replace(array('&','>','<','"'),array('&','>','<','"'),$ret); + } return( $ret ); } -- 2.25.1