Hi,

I've managed to muddle through and get this module working to 99.9% of what I need it to do. However, on the final export, it is stripping out all of the special characters and replacing them with the "safe" replacements. If I set the Views formatter to "Plain Text" it will leave things like spaces alone, but it still replaces many characters and also removes the tags around all my links.

Please assist - This is vital for us to be able to export this data in the correct format, and I've gone through every possible option (even looked into "hacking" the core modules to modify the formatter ((as a last resort)) but that didn't work either).

To be clear, all I am trying to do is take the EXACT, UNCHANGED, UNFILTERED values I have stored in a Taxonomy term and output it to an XML file.

It CANNOT look like this:
<em>Updated June 26, 1997</em><br />

And all HTML included should be output exactly as-is.

Thanks a lot for your help!

Comments

scotttrager’s picture

Status: Active » Needs review

I think I managed to resolve the export side of this issue, at least with a codehack/workaround. For anyone else who needs to do this make sure to comment out the following lines in 'views_data_export.theme.inc':


      // Prevent double encoding of the ampersand. Look for the entities produced by check_plain().
     // $content = preg_replace('/&(?!(amp|quot|#039|lt|gt);)/', '&', $content);
      // Convert < and > to HTML entities.
    //  $content = str_replace(
      //  array('<', '>'),
     //   array('&lt;', '&gt;'),
     //   $content);
  }

Not sure if I did this 100% correctly or what else this might affect, but my output seems to be correct now. There needs to be a simple way to do this outside of code - I'm sure many (if not the majority) of users looking to export data would like to export ALL the data and not necessarily a 100% XML compliant version.

scotttrager’s picture

Status: Needs review » Active

Nope - was wrong - That helped alot, but it was primarily from the "array" lines - removing the rest didn't do much.

I'm still stuck with several characters being converted to characters like †as well as a bizaare issue where an "a" tag is losing it's closing tag if the content inside the anchor is blank.....

Can anyone please help? I'm the only one in my department who know's ANY PHP and this is a bit beyond me.

scotttrager’s picture

Ok fixed the conversion issue by running an iconv on the final string right before it exported - simple enough. Still doesn't solve the other issue (I think i'm going to split that off into a new ticket since it is now "for sure" an unrelated issue)

TenaMurphy’s picture

Issue summary: View changes

I had the same issue today. I need output where the special characters are not encoded for html.

I copied the views-data-export-xml-body.tpl.php file from /sites/all/modules/views_data_export/ into my own /sites/all/themes/[theme_name]/templates/ folder. In my copy, I replaced "print $value;" using the PHP function called html_entity_decode like this:

$value_no_html = html_entity_decode($value, ENT_QUOTES | ENT_XML1, 'UTF-8');
print $value_no_html;

Now, the special characters print plainly without encoding. I hope someone finds this useful.