CSV import not recognising field delimiter

Peter Bishop
Kilo Expert

I am having a problem importing a CSV file using sys_import.do where it appears that the import process isn't recognising the field delimiter. Instead I'm getting the error message:

data contains 1 columns, expected 4

The strange thing is that if I take the contents of the file and copy them to another file, it uploads without issue. I've done a comparison between the two files and they are identical (used a HEX editor to be absolutely sure!) but one works and the other doesn't.

Unfortunately the one that doesn't work is being created by a PowerShell process reading data from an external source so I can't use the same fix. This process *always* fails with the error above.

Am I missing something obvious or is this going to be some bizarre edge case?

Thanks.

2 REPLIES 2

Peter Bishop
Kilo Expert

Why do I always find the solution straight after posting to a forum?!

The issue was PowerShell which was encoding the file as "UCS-2 LE BOM". Once I changed this to "ASCII" (UTF8 also adds BOM, which caused other problems) everything was fine.

That's a day I'll never get back 😞

I agree, I encountered the same case with a file from one team. All was identical ! Except the format  ...
Easy to miss if you don't know this BOM encoding issue  😉