git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@7695
7612ce4b-ef26-0410-bec9-
ea0150e637f0
* Converts html string to given charset
* @param string $string
* @param string $charset
* Converts html string to given charset
* @param string $string
* @param string $charset
+ * @param boolean $htmlencode keep htmlspecialchars encoding
-function charset_encode($string,$charset) {
+function charset_encode($string,$charset,$htmlencode=true) {
+ // 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)) {
$encode=fixcharset($charset);
$encodefile=SM_PATH . 'functions/encode/' . $encode . '.php';
if (file_exists($encodefile)) {
* @param string $in_charset initial charset
* @param string $string string that has to be converted
* @param string $out_charset final charset
* @param string $in_charset initial charset
* @param string $string string that has to be converted
* @param string $out_charset final charset
+ * @param boolean $htmlencode keep htmlspecialchars encoding
* @return string converted string
*/
* @return string converted string
*/
-function charset_convert($in_charset,$string,$out_charset) {
+function charset_convert($in_charset,$string,$out_charset,$htmlencode=true) {
$string=charset_decode($in_charset,$string);
$string=charset_decode($in_charset,$string);
- $string=charset_encode($string,$out_charset);
+ $string=charset_encode($string,$out_charset,$htmlencode);