What we do in life echoes in eternity!
sys7em
Home About Me Diary

How to convert cp1251 to utf-8 with php

posted on: 20:42, November 4th , 2007

Use 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:

Write a comment

*Name
E-mail:
*Security code:
*1+2 = (write in words ;)
*Message

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 "