How to convert cp1251 to utf-8 with php
posted on: 20:42, November 4th , 2007Use this function:
$file = 'db2.sql';
$file_contents = file_get_contents($file);
$fh = fopen($file, "r");
$file_contents = iconv("CP1251", "UTF-8", "$file_contents");
fclose($fh);
//str_replace('foo','bar',$file_contents);
$file2 = 'db.sql';
$file_contents = file_get_contents($file2);
$fh = fopen($file2, "w");
fwrite($fh, $file_contents);
fclose($fh);
Comments:
All materials on this site are licensed under the following license: "Steal every piece of information you can get your hands on and run as fast as you can "