Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This module works great!
But if I try to upload a CSV exported by a Mac, it cannot recognize the new line character, since is not in UNIX format.
I tried to insert this statement in the module
ini_set("auto_detect_line_endings", true);
just before the fgetcsv function
as stated here http://us2.php.net/manual/en/filesystem.configuration.php#ini.auto-detec...
but it didn't help.
Any other with the same problem?
Comment | File | Size | Author |
---|---|---|---|
#5 | tablefield-support_mac_unix_line_endings-1514710-5.patch | 1.33 KB | jenlampton |
#3 | tablefield-line-endings-1514710-3.patch | 656 bytes | brenk28 |
Comments
Comment #1
aperez2242 CreditAttribution: aperez2242 commentedHi,
I'm having the same problem and I make some advances using:
ini_set('auto_detect_line_endings', true);
on line 484, just before:
if (($handle = fopen($file->uri, "r")) !== FALSE) {
It handles all columns right but the first one...
I'll continue working with it.
Comment #2
aperez2242 CreditAttribution: aperez2242 commentedSo... I finally edit the file and set the delimiter to " ; " and save the file as CSV for Windows.
It works perfectly :)
But this should be fixed in the next version to support all characters.
Comment #3
brenk28 CreditAttribution: brenk28 commentedHere is a patch that does the ini_set as described in #1. Patch is against 7.x-2.3.
Comment #4
vitalie CreditAttribution: vitalie commentedWhat about settings.php? ini_set sounds like settings.php.
Comment #5
jenlamptonThis fix solves the problem for me as well. Thank you @pabloid and @aperez2242 for the recommendation, and @brenk28 for the patch. I have added an additional change and that is to return the setting to it's previous value value after we parse the CSV file. I would hate changing that setting to cause other problems.
Comment #7
jenlamptonThis fix will go into the next release of tablefield.