Here is the code I come up:
Code: Select all
<?php
$file = fopen("utf8text.txt","r");
while (!feof($file))
{
$content = fgets($file, 1000000);
$out = iconv ("utf-8","big5", $content);
echo $out;
}
fclose($file);
$ofile = fopen ("out.txt", "w+");
fwrite ($ofile, $out);
fclose($ofile);
?>I have problems regarding this code. When a file is long, output text in text file will be truncated either in the beginning or at the end. However, the displayed text will be okay. I am confused.
What is the problem with this one?
Code: Select all
$ofile = fopen ("out.txt", "w+");
fwrite ($ofile, $out);
fclose($ofile);