From 9f3fdd63121bcf72bfc6b34aea3e26c60416be15 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Fri, 30 Apr 2010 10:35:20 +0000 Subject: [PATCH] 2010-04-30 Miguel de Dios * include/functions_io.php: added in the function "safe_output" the flag $utf8 for set the encoding of output, by default true. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2643 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 5 +++++ pandora_console/include/functions_io.php | 12 +++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index ac0ed6f6bc..ab8c1ace01 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,8 @@ +2010-04-30 Miguel de Dios + + * include/functions_io.php: added in the function "safe_output" the flag + $utf8 for set the encoding of output, by default true. + 2010-04-29 Miguel de Dios * godmode/reporting/reporting_builder.item_editor.php: fixed typo mistake in diff --git a/pandora_console/include/functions_io.php b/pandora_console/include/functions_io.php index c50de50e03..fbee69fb33 100755 --- a/pandora_console/include/functions_io.php +++ b/pandora_console/include/functions_io.php @@ -43,11 +43,12 @@ function safe_input($value) { * who doesn't make the HTML render by itself. * * @param mixed String or array of strings to be cleaned. + * @param boolean $utf8 Flag, set the output encoding in utf8, by default true. * * @return unknown_type */ -function safe_output($value) -{ +function safe_output($value, $utf8 = true) +{ if (is_numeric($value)) return $value; @@ -59,7 +60,12 @@ function safe_output($value) if (! mb_check_encoding ($value, 'UTF-8')) $value = utf8_encode ($value); - $valueHtmlEncode = html_entity_decode ($value, ENT_QUOTES, "UTF-8"); + if ($utf8) { + $valueHtmlEncode = html_entity_decode ($value, ENT_QUOTES, "UTF-8"); + } + else { + $valueHtmlEncode = html_entity_decode ($value, ENT_QUOTES); + } return $valueHtmlEncode; }