Commit d6724f5a authored by catch's avatar catch

Issue #1569894 by sun, alexpott: Update unicode.inc to PHP5

parent e7ebae28
......@@ -74,6 +74,11 @@ function unicode_requirements() {
* An XML parser object or FALSE on error.
*
* @ingroup php_wrappers
*
* @deprecated in Drupal 8.3.0 and will bre removed in Drupal 9.0.0. Use
* xml_parser_create() and
* xml_parser_set_option($xml_parser, XML_OPTION_TARGET_ENCODING, 'utf-8')
* instead.
*/
function drupal_xml_parser_create(&$data) {
// Default XML encoding is UTF-8
......
......@@ -190,7 +190,8 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
*/
protected function parseOpml($opml) {
$feeds = array();
$xml_parser = drupal_xml_parser_create($opml);
$xml_parser = xml_parser_create();
xml_parser_set_option($xml_parser, XML_OPTION_TARGET_ENCODING, 'utf-8');
if (xml_parse_into_struct($xml_parser, $opml, $values)) {
foreach ($values as $entry) {
if ($entry['tag'] == 'OUTLINE' && isset($entry['attributes'])) {
......
......@@ -271,7 +271,8 @@ public function getValidOpml(array $feeds) {
EOF;
$path = 'public://valid-opml.xml';
return file_unmanaged_save_data($opml, $path);
// Add the UTF-8 byte order mark.
return file_unmanaged_save_data(chr(239) . chr(187) . chr(191) . $opml, $path);
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment