Skip to content
Snippets Groups Projects
Commit 26512759 authored by Dries Buytaert's avatar Dries Buytaert
Browse files

- Bugfix: fixed the character when importing news feeds.  Reported at
  http://drupal.org/node/view/2036.
parent f3e39503
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -268,6 +268,8 @@ function import_refresh($feed) { ...@@ -268,6 +268,8 @@ function import_refresh($feed) {
$xml_parser = xml_parser_create(); $xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "import_element_start", "import_element_end"); xml_set_element_handler($xml_parser, "import_element_start", "import_element_end");
xml_set_character_data_handler($xml_parser, "import_element_data"); xml_set_character_data_handler($xml_parser, "import_element_data");
xml_parser_set_option($xml_parser, XML_OPTION_TARGET_ENCODING, "utf-8");
if (!xml_parse($xml_parser, $data, 1)) { if (!xml_parse($xml_parser, $data, 1)) {
return t("failed to parse RSS feed '%site': %error at line %line.", array("%site" => $feed["title"], "%error" => xml_error_string(xml_get_error_code($xml_parser)), "%line" => xml_get_current_line_number($xml_parser))); return t("failed to parse RSS feed '%site': %error at line %line.", array("%site" => $feed["title"], "%error" => xml_error_string(xml_get_error_code($xml_parser)), "%line" => xml_get_current_line_number($xml_parser)));
} }
......
...@@ -268,6 +268,8 @@ function import_refresh($feed) { ...@@ -268,6 +268,8 @@ function import_refresh($feed) {
$xml_parser = xml_parser_create(); $xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "import_element_start", "import_element_end"); xml_set_element_handler($xml_parser, "import_element_start", "import_element_end");
xml_set_character_data_handler($xml_parser, "import_element_data"); xml_set_character_data_handler($xml_parser, "import_element_data");
xml_parser_set_option($xml_parser, XML_OPTION_TARGET_ENCODING, "utf-8");
if (!xml_parse($xml_parser, $data, 1)) { if (!xml_parse($xml_parser, $data, 1)) {
return t("failed to parse RSS feed '%site': %error at line %line.", array("%site" => $feed["title"], "%error" => xml_error_string(xml_get_error_code($xml_parser)), "%line" => xml_get_current_line_number($xml_parser))); return t("failed to parse RSS feed '%site': %error at line %line.", array("%site" => $feed["title"], "%error" => xml_error_string(xml_get_error_code($xml_parser)), "%line" => xml_get_current_line_number($xml_parser)));
} }
......
...@@ -268,6 +268,8 @@ function import_refresh($feed) { ...@@ -268,6 +268,8 @@ function import_refresh($feed) {
$xml_parser = xml_parser_create(); $xml_parser = xml_parser_create();
xml_set_element_handler($xml_parser, "import_element_start", "import_element_end"); xml_set_element_handler($xml_parser, "import_element_start", "import_element_end");
xml_set_character_data_handler($xml_parser, "import_element_data"); xml_set_character_data_handler($xml_parser, "import_element_data");
xml_parser_set_option($xml_parser, XML_OPTION_TARGET_ENCODING, "utf-8");
if (!xml_parse($xml_parser, $data, 1)) { if (!xml_parse($xml_parser, $data, 1)) {
return t("failed to parse RSS feed '%site': %error at line %line.", array("%site" => $feed["title"], "%error" => xml_error_string(xml_get_error_code($xml_parser)), "%line" => xml_get_current_line_number($xml_parser))); return t("failed to parse RSS feed '%site': %error at line %line.", array("%site" => $feed["title"], "%error" => xml_error_string(xml_get_error_code($xml_parser)), "%line" => xml_get_current_line_number($xml_parser)));
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment