I'm working on a small social script.. The content will be in Urdu language for which I encoded the files with UTF-8.

I'm having problems with the login page. The problem is that I'm unable to execute setcookie() function. I'm getting the following error;

Warning: Cannot modify header information - headers already sent by (output started at E:\xampp\htdocs\socio\header.php:12) in E:\xampp\htdocs\socio\index.php on line 30

If I change the file encoding back to normal, then the setcookie() function works fine..

Somebody kindly tell me the solution to this problem.

You cannot output anything before using setcookie() . Presumably you have used print in the 'header.php' file, on line 12.
Set your cookies first then print.

Sometimes, when encoding a page as UTF-8 it puts a character at the beginning of a file that causes errors like that. It might not be the case here since the error is on line 12 but it might cause you problems later.

Thanks for the help guyz.. The problem is now resolved. The title tag in the header file was creating the problem. I include this file after setcookie() and it works fine now.