php - CSV upload showing umlauts but it doesn't upload – and „ or “ -


im having issues csv upload script need upload german text mysql database translation purposes.

everything utf8 when runs script , inserts database. characters there, umluats show fine – (&mdash) , „ or “ go in blank.

the snippet of text im trying upload

actual text in csv = "testing – seit über „es ist“ das unternehmen."

database after upload = "testing seit über es ist das unternehmen."

it uploads umlauts puts space dash , quotes should be.

the csv encoded in utf-8

if take utf8_encode() off insert breaks @ first special character.

here script

header('content-type: text/html; charset=utf-8'); require_once("../cfg/database.php"); mysql_query("set names 'utf8'"); extract($_post);  $file = $_files['csv']['tmp_name'];  $handle = fopen($file,"r"); $data = array();  $count = 0; if (!empty($_files['csv']['size'])) {     while (($data = fgetcsv($handle,1000,",")) !==false) {         if ($count != 0) {             mysql_query("insert table_name set `text` = '" . utf8_encode($data[5]) . "'") or die(mysql_error());         }         $count++;     }  } 

any appreciated have searched , searched , can not find solution.

edit: note self, not rely on excel correctly save encoding of csv utf-8. use notepad :)


Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -