Thanks Paul & Nisse,
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 ?
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.
Regards, Cor
----- Original Message -----
From: "Nisse Engström" <news.NOSPAM.0ixbtqKe@xxxxxxxx>
To: <php-general@xxxxxxxxxxxxx>
Sent: Friday, February 06, 2009 9:21 AM
Subject: Re: require() causing strange characters ?
On Fri, 6 Feb 2009 06:34:41 +0100, cr.vegelin@xxxxxxxxx wrote:
I have a script called "test.php":
<?php echo "C"; require("echo.php"); echo "D"; ?>
and a script called "echo.php":
<?php echo "test"; ?>
With IE and Firefox it shows: CtestD
but when I view the source, it seems to be: C�testD
When debugging it, it seems that:
"CtestD" has length 9 in stead of 6
pos1 has char=C ord=67
pos2 has char=� ord=239
pos3 has char=� ord=187
pos4 has char=� ord=191
rest okay ...
Any idea what's causing this and how to solve it ?
echo.php has a utf-8 BOM character (Byte Order Mark).
See if your editor has an option to store it without a BOM.
/Nisse
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php