[Plugin: CSV Importer] Escaping quotation marks / serialized array
-
Hi,
I wrote a script which parses html DOM and outputs one csv file for all html pages needed to be imported.
Everything works fine, except issue I encounter with quotation marks.
I looked at the example.csv fle and didn’t manage how should I escape them.The problematic field I’ve got is a serialized array that should be saves as a custom field. It holds values for several input fields.
The serialized array is being crreated via the serialize($arr);, and as you know it has a lot of quotation marks inside.When I look in the my csv file, I see the seiralized array something like this:
a:6:{s:10:””_video_wmv””;s:11:””cookegg.wvx””;s:7:””YouTube””;s:15:””www.youtube.com””;s:8:””Facebook””;s:10:””www.fb.com””;s:4:””Flix””;s:12:””www.flix.com””;s:8:””duration””;s:0:””””;s:15:””shorter_excerpt””;s:0:””””;}”But when I look in the database, I see it like this –
s:196:”a:6:{s:10:”_video_wmv”;s:11:”cookegg.wvx”;s:7:”YouTube”;s:15:”www.youtube.com”;s:8:”Facebook”;s:10:”www.fb.com”;s:4:”Flix”;s:12:”www.flix.com”;s:8:”duration”;s:0:””;s:15:”shorter_excerpt”;s:0:””;}”;meaning, a s:196:” has been added to the beginning of it, and a “; added to the end.
This causes the WP not to interpret the data as needed to the appropriate fields.I don’t even know if is an issue of escaping quotation marks, rather than have the serialized array be saved in the db as it is, without adding it these prefix and suffix.
Any idea how can I deal with that?
Many thanks,
Maor
- The topic ‘[Plugin: CSV Importer] Escaping quotation marks / serialized array’ is closed to new replies.