I want to give the user the opportunity to import the csv file into my php / mysql system, but I ran into some encoding problems when the language is Russian, which can only be stored in tabs with tabs UTF-16.
Now my database is in latin1, but I will change it to utf-8, as described in the question "a-script-to-change-all-tables-and-fields-to-the-utf-8 -bin-comparison -to-MySQL "
But how do I import a file? and save the lines?
Should I, for example, translate it to html_entitites?
I use the command fgetcsvto get data from a csv file. My code looks something like this.
file_put_contents($tmpfile, str_replace("\t", ";", file_get_contents($tmpfile)));
$filehandle = fopen($tmpfile,'r');
while (($data = fgetcsv($filehandle, 1000, ";")) !== FALSE) {
$values[] = array(
'id' => $data[0],
'type' => $data[1],
'text' => $data[4],
'desc' => $data[5],
'pdf' => $data[7]);
}
, xls csv excel, "_", - excel UTF16.