Plugin Author
Arshid
(@arshidkv12)
Please upload to Google drive and check it.
Upload what? I didn’t provide any fixes. I’m asking that this be fixed. 🙂
Plugin Author
Arshid
(@arshidkv12)
Please upload CSV to google drive and check it.
I cannot do that, because that would violate our privacy policy.
I did, however, quote a part of one of the lines, directly from the database, and from the CSV above.
Plugin Author
Arshid
(@arshidkv12)
Create a test form from localhost and try it.
Some additional information. The file is being exported as a CSV in UTF-8 format:
root@lb17 17:41:41
> /data/www # file -i cfdb7-2021-08-11.csv
cfdb7-2021-08-11.csv: text/plain; charset=utf-8
HOWEVER, if you open directly after downloading it, it opens it up in a non UTF-8 format. My coworker was kind enough to provide a workaround for this:
Instructions are:
1. Open new excel file
2. From the Data Tab -> Click “From Text/CSV”
3. Point to the file downloaded
4. On the Next Page -> file origin to 65001-Unicode (UTF-8)
5. Click load
You might need to do some additional digging into this to see if you can force Excel to automatically open in UTF-8 format.
FYI, my excel version is “Microsoft® Excel® for Microsoft 365 MSO (16.0.14228.20216) 64-bit”
UPDATE! I have a workaround! Two file edits, and this will allow CSV files to be directly opened within Microsoft Excel without having to use the special instructions above.
FILE: inc/admin-subpage.php (lines 462-464)
SEARCH FOR:
echo " <a href='".esc_html($_SERVER['REQUEST_URI'])."&csv=true&nonce=".$nonce."' style='float:right; margin:0;' class='button'>";
_e( 'Export CSV', 'contact-form-cfdb7' );
echo '</a>';
ADD BEFORE:
/***
* @BearlyDoug (on ww.wp.xz.cn) Edit: Export as Excel CSV file...
*/
echo "<a href='".esc_html($_SERVER['REQUEST_URI'])."&csv=true&excel=true&nonce=".$nonce."' style='float:right; margin: 0 0 0 7px;' class='button'>";
_e( 'Export as Excel CSV', 'contact-form-cfdb7' );
echo '</a>';
FILE: inc/export-csv.php (lines 122-123)
SEARCH FOR:
foreach ($resultTmp as $key => $value):
$matches = array();
ADD AFTER:
/***
* @BearlyDoug (on ww.wp.xz.cn) Edit: Export as Excel CSV file...
*/
if(isset($_REQUEST['excel']) && $_REQUEST['excel'] == "true") {
$newValue = mb_convert_encoding($value, "cp1252", "UTF-8");
$value = $newValue;
}
There’s probably a more efficient way to handle this… possibly by simply changing the charset to cp1252 (AKA Windows-1252). I’ll test that functionality now, and will report back in a new reply.
Hope this helps!
Okay, I’ve tried changing
header("Content-Encoding: UTF-8");
header("Content-Type: text/csv; charset=UTF-8");
to cp1252, CP1252, windows-1252 and Windows-1252 with no luck.
I’ll have to defer to you how best to implement my suggested change in a more efficient manner, @arshidkv12. 🙂