-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code field empty when trying to import CSV file #40
Comments
I had this problem as well; here's what I submitted to https://www.chriswgerber.com/dfp-ads/import-from-csv/ (which is awaiting moderation):
|
Hi tdmalone |
Hi @hdraye, it may or may not be the exact same problem you're experiencing, but basically I found the character (which is a 'zero width no-break space', see here for details) couldn't be removed easily by trying to edit it out. Copying and pasting the entire text of the CSV into Notepad, and then saving as a brand new CSV file, removed the character. I don't totally understand character-encoding but it could be because Notepad didn't support that particular character, so stripped it out. There are probably better ways to solve this but this is what I did. |
Thanks for reporting this. If someone would like to submit a PR and filter out the BOM I would be able to test and merge. I don't have the bandwidth to make the change myself. Here's an example of how it can be removed: http://stackoverflow.com/a/15423899/2697450 |
@ThatGerber, I remember vaguely that when I checked I thought this probably should be fixed in the CSV lib you are using to handle files. Maybe you can have a look when you have some time and if it's a bug in the library we can report it over there. |
@krossekrabbe Would be able to provide an example file that I could use to test a potential fix? Like I said in another post, I don't work in PHP or DFP much anymore and don't have access to a file to recreate it. My email address is in my profile. Thanks! |
See https://wordpress.org/support/topic/import-from-csv-not-working
This problem is caused by the byte order mark (0xEFBBBF) preceeding the export downloaded from dfp. The csv reader puts the BOM into the first array key and so
$row['#Code']
fails because it is actually$row[chr(0xEF).chr(0xBB).chr(0xBF).'#Code']
Temporary solution is opening the export in vim and removing the BOM with
:set nobomb
.The text was updated successfully, but these errors were encountered: