diff --git a/api/src/Translation.php b/api/src/Translation.php index ab6a9fc1b7..3ced7289c5 100644 --- a/api/src/Translation.php +++ b/api/src/Translation.php @@ -851,10 +851,14 @@ class Translation * @param string|boolean $from charset $data is in or False if it should be detected * @param string|boolean $to charset to convert to or False for the system-charset the converted string * @param boolean $check_to_from =true internal to bypass all charset replacements - * @return string|array converted string(s) from $data + * @return NULL|string|array converted string(s) from $data */ static function convert($data,$from=False,$to=False,$check_to_from=true) { + if (empty($data)) + { + return $data; // no need for any charset conversation (NULL, '', 0, '0', array()) + } if ($check_to_from) { if ($from) $from = strtolower($from); @@ -925,7 +929,8 @@ class Translation { foreach($data as $key => $str) { - $ret[$key] = self::convert($str,$from,$to,false); // false = bypass the above checks, as they are already done + $ret[$key] = empty($str) ? $str : // do NOT convert null to '' (other empty values need no conversation too) + self::convert($str,$from,$to,false); // false = bypass the above checks, as they are already done } return $ret; }