I am learning about handling UTF8 character sets and the recommendation is to explicitly set the encoding type in the output headers within your PHP script like so:
header('Content-Type: text/html; charset=utf-8');
My question is about where I should place this header. I have a config file that is included into every script and is run first. Should I place it at the top of that file so that this header is included first in every php file?
Will that affect my ability to set other headers, including a header location redirect down the line? Or should I place this just before any html output, such as the rendering of my template file? Ie- can this header be in place before ALL other php processing, and what are the consequences of doing that? Does it affect anything server side, or just the encoding of the output?
Thanks.!