So, I am downloading the csv file. One of the columns has one quote.
145 Test St'
Array
( [0] => 2 [1] => 20 [2] => 145 Test St [3] => Test City [4] => 1455 [5] => 919749797 )
As you can see. Instead of a single quote ( ' ), it becomes.
Here I use htmlspecialchars ($ row) which gives the result.
( [0] => 2 [1] => 20 [2] => [3] => Test City [4] => 1455 [5] => 919749797 )
The first question is why (') becomes ()?
Second question: why does the value disappear after using htmlspecialchars () ?
Third question: How to save ( ' )?
Thanks to those who can answer.
EDIT:
$row = array_map('str_getcsv', file($_FILES['file']['tmp_name'])); $csv = Array(); $head = $row[0]; $col = count($row[0]); unset($row[0]); pre($row[1]); $row[1] = array_map('htmlentities', $row[1]); pre($row[1]);
EDIT:
pre () is a function that I created that works like
<pre></pre>.
EDIT:
I am watching a CSV file using the -mime file on the terminal. Its encoding is unknown 8-bit . I am converting a CSV file to UTF-8, saving as. After that I will be able to download the CSV file. The problem is encoding the CSV file.
Can I convert a file to UTF-8?
php encoding mongodb csv export-to-csv
Oblivion coder
source share