[wp-hackers] Why functions.php is not UTF-8?

Otto otto at ottodestruct.com
Tue Mar 22 17:05:10 UTC 2011

On Tue, Mar 22, 2011 at 11:55 AM, Rics <ricardo.cezar at gmail.com> wrote:
> While working on a new child theme for Twentyten I started to
> experience a lot of anoying problems with chars sent early to the
> browser. After a lot of debuging I realize that my functions.php was
> in UTF-8 and Twentyten's version was in ANSI encoding.

No. Text is text. The functions.php file in twentyten should contain
nothing that would be different between ANSI or UTF-8. There is no
"encoding" when all the characters in the file are below char code
128. The first octet of UTF-8 is the same as ISO Latin 1 and ASCII.

Now, if you were specifically saving as UTF-8, then your text editor
may have been adding what's known as a Byte Order Mark (BOM) to the
beginning of the file. PHP does not understand the BOM and will treat
it as printable text. Therefore, you need to configure your text
editor to not save a BOM to *.php files. You can save it as UTF-8,
just not with a BOM.

More info: http://en.wikipedia.org/wiki/Byte_order_mark


More information about the wp-hackers mailing list