problem delimiter

Closed
ImportWP Pro - WordPress XML & CSV Importer ImportWP Pro - WordPress XML & CSV Importer March 21, 2019
Login to reply
James Collings Support Agent
2 weeks ago
Resolved.
James Collings Support Agent
1 month ago

I have just had a thought about this, i resticted the search to include quotes, might be best to not search for them and replace all occurances anywhere in the file.

// replace 

$contents = str_replace('"!#"', '","', $contents);
// with
$contents = str_replace('!#', ',', $contents);
James Collings Support Agent commented privately
gael dompeyre
1 month ago

Hi again, can you tell me which is the file of the plugin that opens the csv and begin to read it?

James Collings Support Agent
1 month ago

Ok, i will put this to the top of the list and see what i can do.

gael dompeyre
1 month ago

Hi,
After verifications, I'm really stucked with the !#. It comes from a standard for real estate files. I'm looking for another solutions on my side too.
But also waiting for your answer...

Regards

James Collings Support Agent
1 month ago

Hi Gael,

I have had a look into this, and there is a limitation with the way that csv files are read using php, the delimiter can only be one character as shown in the documentation: http://php.net/manual/en/function.fgetcsv.php#refsect1-function.fgetcsv-parameters , are you stuck with using !# as a delimiter or can this be changed to a single character?

The only solution for using your !# delimiter would for some way to pre process the fle before it is uploaded (replacing the !# with a single character, i will do a bit of research to see what can be done.

James

gael dompeyre commented privately
James Collings Support Agent
1 month ago

Hi Gael,

You should be able to set if via the delimiter and enclosure via the settings: https://www.importwp.com/documentation/importing-csv-file/ , if this is not the case can you send me a copy of your csv file and i can look into this when i am back in the office later today.

James

gael dompeyre
1 month ago

Hi,

I have to split a csv file in wich the fields are separated with two caracters: !# but any time I try to record an importer, it works with only the first caracter.
So I get
#"477 / 789"#"Location"#"APPARTEMENT"#"31500"#"TOULOUSE"
instead of

477 / 789 Location APPARTEMENT 31500 TOULOUSE

How can I record a pair of caracters as delimiters?
regards