Problems, need help? Have a tip or advice? Post it here.
4 posts Page 1 of 1
Hi,

Ok, I am wasting time sionce this morning at no avail.

I try to export my products page to a CSV file.

It seems that the code KK gave here: https://www.couchcms.com/forum/viewtopic.php?f=8&t=11378
would work. But because my website is in French, with commas and accents everywhere, it mess up the CSV file.

I added the code below:
Code: Select all
<?php require_once('couch/cms.php'); ?>
<cms:content_type 'text/csv' />
<cms:pages masterpage='classiques.php' folder='caravage' limit='100' order='asc'>
<cms:if k_paginated_top >title,description,URL,URLText,date,image1</cms:if>
<cms:format_csv k_page_title />,<cms:format_csv description />,<cms:format_csv k_page_link />,<cms:format_csv k_page_link />,<cms:format_csv date />,<cms:format_csv gg_image />,
</cms:pages>
<?php COUCH::invoke(); ?>


and the result (see attachment caravage.csv, is a million mile from the exemple file csv-upload-demo.csv)

Anybody has any idea how to sanitize that?

Attachments

Ok, I am progressing. In the function.php I got

Code: Select all
$content = str_replace(',', ' ', $content);


now for L'argent (for example) I got L&#039;


How do I fix this output?

I tried
Code: Select all
\'
but no luck
CSV addon supports custom delimiters, so.. I suggest to use some obviously unique symbol (^, $, |) (one single-byte character). Same applies to enclosures.

An old trick could possibly be to use ASCII delimited text with dedicated unit separator and record separator, though I never tried that myself. https://ronaldduncan.wordpress.com/2009 ... ited-text/
Join COUCH:TALK channel here https://t.me/couchcms_chat
Ryazania — a framework to boost productivity with Add-ons viewtopic.php?f=2&t=13475
Support my efforts to help the community https://boosty.to/trendo/donate
Thanks Trendoman,

In fact, it was simple as that:

Code: Select all
 $content = str_replace('&#039;', '´', $content);
        $content = str_replace(',', ' ', $content);


I can't believe I spent hours on that one. I am getting too old... :evil:
4 posts Page 1 of 1