Hello @kartik,
file_get_contents / file_put_contents will not magically convert encoding.
You have to convert the string explicitly; for example with iconv() or mb_convert_encoding().
Try this:
$data = file_get_contents($npath);
$data = mb_convert_encoding($data, 'UTF-8', 'OLD-ENCODING');
file_put_contents('tempfolder/'.$a, $data);
Or alternatively, with PHP's stream filters:
$fd = fopen($file, 'r');
stream_filter_append($fd, 'convert.iconv.UTF-8/OLD-ENCODING');
stream_copy_to_stream($fd, fopen($output, 'w'));
Hope it helps!!
ThanK You!!