Closed (won't fix)
Project:
Views data export
Version:
7.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
2 Aug 2013 at 10:13 UTC
Updated:
6 Dec 2024 at 14:38 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
steven jones commentedI suspect that you need to run the dev version, and you need to use the 'Keep HTML tags' option. I've got some tests that I'll beef up to make sure that attributes are handled correctly.
Comment #2
steven jones commentedBeefed up the HTML tests
Comment #3
steven jones commentedPushed that change to the tests into 7.x-3.x
Comment #4
L5 commentedThanks! The 7.x-3.x-dev (2013-Aug-06) seems to work with single quotes. But it still removes double quotes.
Comment #5
steven jones commentedCould you provide an example test case please?
What exactly are you expecting and what is output?
Comment #6
L5 commentedI need an export to CSV. I'm using Views data export 7.x-3.x-dev (2013-Aug-06). The view has two fields. Let's say email and items. The field email doesn't use any html tags. The field items does use html tags.
For the items output I use a field "Global: custom text" and give it a value. I want to use some XML code like:
"<items><item id=""001""/></items>"The output will be:
So there is no value for items. I expect the output would be:
If I change the items field to "Global: PHP" (using https://drupal.org/project/views_php) and give it an output like:
echo '"<items><item id=""001""/></items>"';The output will be (even if I escape the double quotes):
So all double quotes are removed, but the XML code is displayed. I would expect:
I hope my example is clear enough?
Comment #7
steven jones commentedYou will need to use the 'Quote values' option to get the correct quotes added in the output.
Comment #8
L5 commentedYes, but with the 'Quote values' option I will have the following output:
So al values are quoted. In this case the proper solution should have an output with only the XML quoted, like:
Comment #9
steven jones commentedWhy does that matter?
I understand that it adds a lot of unnecessary quotes, but is that really a problem?
Comment #10
L5 commentedThat was my first thought too. The exported CSV is used for an import to Parcelware (PostNL). Their software is refusing a file with unnecessary quotes, only the XML part is allowed to use double quotes. So in this case it's a problem.
Comment #11
steven jones commentedUrgh.
I hate the fact that CSV isn't a standard at all!
Okay, so you want to be able to quote by specific fields, fair enough.
Comment #12
L5 commentedYes, that's probably a better title / description. :)
Comment #14
cotillardq commentedDid you ever found a solution for this? I have the same issue where I only need to quote certain fields.
Comment #15
cotillardq commentedOk this is how I solved it. Not very clean but it works.
in /modules/views_data_export/theme/views_data_export.theme.inc
replaced line 181
$vars['themed_rows'][$i][$j] = $wrap . str_replace('"', $replace_value, $output) . $wrap;
with
$output = str_replace('\"', "%%", $output);
$output = $wrap . str_replace('"', $replace_value, $output) . $wrap;
$vars['themed_rows'][$i][$j] = str_replace('%%', '"', $output);
Comment #16
steven jones commentedSorry for the lack of attention to your issue, please accept my apologies.
Drupal 7 is going to be end-of-life'd by the community in approximately 1 month.
As such, I am closing all non-critical looking, non-PHP compatibility issues for Views Data Export to tidy up the issue queues and reduce the noise. You can read about this on #3492246: Close down Drupal 7 issues.
If you feel like this issue has been closed by mistake, please do comment about re-opening it.
If you feel like the ticket is still relevant for the 8.x-1.x version of the module, then please search for a duplicate issue first, and if there really isn't one (and you've looked properly) then change the version on the ticket and re-open.
Thanks to everyone involved in this issue: for reporting it, and moving it along, it is truly appreciated.
The Drupal community wouldn't be what it is today without your involvement and effort, so I'm sorry that we couldn't get this issue resolved. Hopefully we'll work together in a future issue though, and get that one resolved :)