Re: Re: require() causing strange characters ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks Nisse,

----- Original Message ----- From: "Nisse Engström" <news.NOSPAM.0ixbtqKe@xxxxxxxx>
To: <php-general@xxxxxxxxxxxxx>
Sent: Sunday, February 08, 2009 6:06 PM
Subject: Re:  Re: require() causing strange characters ?


On Fri, 6 Feb 2009 10:11:49 +0100, cr.vegelin@xxxxxxxxx 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

I've tested it again, from scratch with Notepad editor:

echoUTF8.php        <?php require("echoUTF8sub.php"); ?>
echoUTF8sub.php   <?php echo "test"; ?>
and keep getting strange characters.

Would you be so kind to run these 2 scripts on your pc ?

TIA, Cor



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux