Re: Re: require() causing strange characters ?
| From: | Nisse Engström | Date: | Sun, 08 Feb 2009 17:06:59 +0000 |
| Subject: | Re: Re: require() causing strange characters ? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-287925@lists.php.net to get a copy of this message | ||
On Fri, 6 Feb 2009 10:11:49 +0100, cr.vegelin@gmail.com wrote:
> I saved both scripts with ANSI in stead of UTF-8 and the problem is gone.
> So the utf-8 BOM character (Byte Order Mark) caused it.
> Unfortunately my editor has no option to store BOM-free scripts.
>
> Is it standard that PHP scripts should be saved without a BOM character ?
This is not a PHP matter, unless PHP 6 (which will have
Unicode support) does something with it. PHP 5 just outputs
it as is.
A BOM character is supposed to be the *first* character in
a text stream. Otherwise it should be treated as a
ZERO WIDTH NON-BREAKING SPACE.
<http://unicode.org/faq/utf_bom.html#bom1>
> Test results ...
> If "test.php" (utf8) requires "echo.php" (utf8), page source has
> "C�testD",
> size 9
> If "test.php" (ansi) requires "echo.php" (utf8), page source has
> "CtestD", size 7
> If "test.php" (ansi) requires "echo.php" (ansi), page source has
> "CtestD",
> size 6
>
> The reason for asking is that sometimes "" is displayed on some pages.
That means you've used a utf-8 BOM in a page using an 8-bit
character encoding (eg. iso-8859-1 or similar), or that you
have utf-8 encoded it twice.
/Nisse