That's right, the import process imports four terms, while two are expected.
In fact, there are two delimiters in your text:
- the first is the double quote " " ";
- the second is the combinaison of two double quotes and a comma " "," ".
As the term extract of a line uses a basic php function (explode), there is an import error.
In order to avoid this problem, I advise you to choose a never used delimiter, as the symbol " ¤ " or even a combinaison as " A8èV$+# ". So your import text will be: Parent¤Childs, with, commas
or ParentA8èV$+#Childs, with, commas
Smarter term extract process can be implemented, but it's currently not a priority for me, because delimiter can be chosen.
Example I indicate in the advanced help is similar and has same problem, so I'm going to add some precision on it.
Thanks for the detailed and prompt explanation. In my case, I can re-export the data with any delimiters I choose, so this will not be a problem.
However, I guess I just expected it to work that way, since I believe that enclosing a field with double quotes is rather common when having a comma in the field. I believe this is how MySQL (INTO OUTFILE) behaves (maybe also Excel). Wikipedia mentions this too in http://en.wikipedia.org/wiki/Comma-separated_values.
Also testing fgetcsv, shows the same results:
$ cat /tmp/a.csv
Hello, "Hello, world"
Test, "This, is, a, test"
$ php -a
Interactive shell
php > $f = fopen("/tmp/a.csv","r");
php > print_r(fgetcsv($f));
Array
(
[0] => Hello
[1] => Hello, world
)
php > print_r(fgetcsv($f));
Array
(
[0] => Test
[1] => This, is, a, test
)
I haven't looked into the code of this module, but those are the reasons I expected it to work this way.
New release 6.x-4.1 complies with csv standards better. It improves the import process and allows now any separator and delimiter. A new option "Enclosure" has been added to allow any import. Hope that can help.
Comments
Comment #1
Daniel_KM commentedHi,
Thanks for your remark.
That's right, the import process imports four terms, while two are expected.
In fact, there are two delimiters in your text:
- the first is the double quote "
"";- the second is the combinaison of two double quotes and a comma "
","".As the term extract of a line uses a basic php function (explode), there is an import error.
In order to avoid this problem, I advise you to choose a never used delimiter, as the symbol "
¤" or even a combinaison as "A8èV$+#". So your import text will be:Parent¤Childs, with, commasor
ParentA8èV$+#Childs, with, commasSmarter term extract process can be implemented, but it's currently not a priority for me, because delimiter can be chosen.
Example I indicate in the advanced help is similar and has same problem, so I'm going to add some precision on it.
Sincerely,
Daniel Berthereau
Knowledge manager
Comment #2
yhager commentedThanks for the detailed and prompt explanation. In my case, I can re-export the data with any delimiters I choose, so this will not be a problem.
However, I guess I just expected it to work that way, since I believe that enclosing a field with double quotes is rather common when having a comma in the field. I believe this is how MySQL (INTO OUTFILE) behaves (maybe also Excel). Wikipedia mentions this too in http://en.wikipedia.org/wiki/Comma-separated_values.
Also testing fgetcsv, shows the same results:
I haven't looked into the code of this module, but those are the reasons I expected it to work this way.
Thanks again!
Comment #3
Daniel_KM commentedHi,
Thanks you for your remark.
New release 6.x-4.1 complies with csv standards better. It improves the import process and allows now any separator and delimiter. A new option "Enclosure" has been added to allow any import. Hope that can help.
Best regards,
Daniel Berthereau
Comment #4
Daniel_KM commented