From a080ce5f0f4d6b7be1adf9d6057ce63566633a7c Mon Sep 17 00:00:00 2001 From: Steven Wittens Date: Mon, 12 Jul 2004 21:38:41 +0000 Subject: [PATCH] Slightly improved code in drupal_xml_parser_create. --- includes/common.inc | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/includes/common.inc b/includes/common.inc index 8ef824daccc..ac862a6e2bc 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -1279,29 +1279,26 @@ function drupal_xml_parser_create(&$data) { if (!in_array(strtolower($encoding), $php_supported)) { if (function_exists('iconv')) { $out = @iconv($encoding, 'utf-8', $data); - if ($out !== false) { - $data = $out; - $encoding = 'utf-8'; - } } else if (function_exists('mb_convert_encoding')) { $out = @mb_convert_encoding($data, 'utf-8', $encoding); - if ($out !== false) { - $data = $out; - $encoding = 'utf-8'; - } } else if (function_exists('recode_string')) { $out = @recode_string($encoding . '..utf-8', $data); - if ($out !== false) { - $data = $out; - $encoding = 'utf-8'; - } } else { watchdog(t("Unsupported XML encoding '%s'. Please install iconv, GNU recode or mbstring for PHP.", $encoding)); return 0; } + + if ($out !== false) { + $data = $out; + $encoding = 'utf-8'; + } + else { + watchdog(t("Could not convert XML encoding '%s' to UTF-8.", $encoding)); + return 0; + } } $xml_parser = xml_parser_create($encoding);