[Plugin: Custom Contact Forms] export troubles, newlines and html encodes
A client of mine uses the custom-contact-form plugin. When exporting the submissions to a csv file, he encountered some troubles lately.
The troubles are:
1. multi-lined fields are exported on multiple lines in the csv. This is also interpreted as multiple lines by a spreadsheet program like Excel. This then looks like a mess.
2. Some characters are encoded when stored the database. For example the &-sign is encoded as & and the quote (‘) is encoded as ' When exporting the encoding is not translated. Because the delimiter is also a semicolon, Excel interprets this as extra fields. This also messes things up pretty good in Excel.
How did I solve this? By removing the newline characters, and by decoding the special characters.
Old code (in file modules/export/custom-contact-forms-export.php):
$line = $data->parseUserData($data_array[$k], true);
$temp = $data->parseUserData($data_array[$k], true);
$temp = str_replace ( “\r\n”, ” “, $temp );
$temp = htmlspecialchars_decode($temp, ENT_QUOTES);
$line = $temp;
With kind regards,
- The topic ‘[Plugin: Custom Contact Forms] export troubles, newlines and html encodes’ is closed to new replies.