note 123203 added to function.file-put-contents

From: Date: Sat, 06 Oct 2018 04:07:13 +0000
Subject: note 123203 added to function.file-put-contents
Groups: php.notes 
Request: Send a blank email to php-notes+get-209379@lists.php.net to get a copy of this message
I faced the problem of converting a downloaded csv file that had Windows-1252 encoding, so to convert it to UTF-8 this worked for me: $from = 'Windows-1252'; $to = 'UTF-8'; $content = file_get_contents($this->path()); file_put_contents($this->path(), mb_convert_encoding($content, $to, $from)); where "$this->path()" has the path of the file... Using this the file is converted from Windows-1252 to UTF-8. With this you can import it with mysqlimport with no problems. ---- Server IP: 208.43.231.9 Probable Submitter: 187.148.76.209 ---- Manual Page -- http://php.net/manual/en/function.file-put-contents.php Edit -- https://master.php.net/note/edit/123203 Del: integrated -- https://master.php.net/note/delete/123203/integrated Del: useless -- https://master.php.net/note/delete/123203/useless Del: bad code -- https://master.php.net/note/delete/123203/bad+code Del: spam -- https://master.php.net/note/delete/123203/spam Del: non-english -- https://master.php.net/note/delete/123203/non-english Del: in docs -- https://master.php.net/note/delete/123203/in+docs Del: other reasons-- https://master.php.net/note/delete/123203 Reject -- https://master.php.net/note/reject/123203 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#209379) next »