Skip to content

missing line end when export product description #28

@xiezhensheng

Description

@xiezhensheng

When I export full product information, I found the line end is removed from the product description. All my multi-line product description becomes one paragraph.

I found the code deliberately removed the \r \n chars, but not sure exactly why. I understand ms excel has problems to deal with special chars between "". But open office or libre doesn't. And this is very clearly stated in the readme.

This actually make the import/export product information not usable.

I would like to know the consideration here.

Thanks.

in the following code in easypopulate_4_functions.php

function ep_4_rmv_chars($filelayout, $active_row, $csv_delimiter = "^") {
// $datarow = ep_4_rmv_chars($filelayout, $active_row, $csv_delimiter);
$dataRow = '';

$problem_chars = array("\r", "\n", "\t"); // carriage return, newline, tab
foreach ($filelayout as $key => $value) {
// $thetext = $active_row[$key];
// remove carriage returns, newlines, and tabs - needs review
$thetext = str_replace($problem_chars, ' ', $active_row[$key]);
// encapsulate data in quotes, and escape embedded quotes in data
$dataRow .= '"' . str_replace('"', '""', $thetext) . '"' . $csv_delimiter;
}
// Remove trailing tab, then append the end-of-line
$dataRow = rtrim($dataRow, $csv_delimiter) . "\n";

return $dataRow;
}

change the line:
$problem_chars = array("\r", "\n", "\t"); // carriage return, newline, tab
to
$problem_chars = array("\t"); // carriage tab
will just do the job and don't break the csv downloading

it is also interesting to see this line:
// remove carriage returns, newlines, and tabs - needs review

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions