Re: require() causing strange characters ?
| From: | Nisse Engström | Date: | Fri, 06 Feb 2009 08:21:58 +0000 |
| Subject: | Re: require() causing strange characters ? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-287798@lists.php.net to get a copy of this message | ||
On Fri, 6 Feb 2009 06:34:41 +0100, cr.vegelin@gmail.com 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