summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorSteven Wittens <steven@10.no-reply.drupal.org>2004-07-12 21:38:41 +0000
committerSteven Wittens <steven@10.no-reply.drupal.org>2004-07-12 21:38:41 +0000
commita080ce5f0f4d6b7be1adf9d6057ce63566633a7c (patch)
treec4a59df76543dfb83e827d4510bd5e6d47873fd9 /includes
parent77c0b577dac74a7d9941fa6a4be7f1d2ebdc4a90 (diff)
downloadbrdo-a080ce5f0f4d6b7be1adf9d6057ce63566633a7c.tar.gz
brdo-a080ce5f0f4d6b7be1adf9d6057ce63566633a7c.tar.bz2
Slightly improved code in drupal_xml_parser_create.
Diffstat (limited to 'includes')
-rw-r--r--includes/common.inc21
1 files changed, 9 insertions, 12 deletions
diff --git a/includes/common.inc b/includes/common.inc
index 8ef824dac..ac862a6e2 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);