Forum Moderators: coopster
This is the code example:
************
<?
//index.php:
echo 'my name is ';
include('inc.php');
?>
************
************
<?
//inc.php:
echo 'andres';
?>
************
I should get:
my name is andres
But in IE I get this:
my name is []andres
The brackets [] aren't brackets per se, they are a strange square character that gets inserted on each include (only in IE). Since I've got some includes before the doctype, all my layout gets screwed up. How can I fix this? Im running apache 2.0.55 with Php 4.4.0 on winxp.
Thanks.
 is a zero-width non-breaking space (0xFEFF in hex). When you say you converted from ANSI to UTF-8, how exactly did you convert the files? Did you "Save as Unicode" in Notepad or something similar? If so, your files may actually be in UTF-16 rather than UTF-8, and in any case the file contents are preceeded by a Byte-Order Mark (BOM) which is causing all the trouble.
Here are a few recent threads about the BOM:
[webmasterworld.com...]
[webmasterworld.com...]
[webmasterworld.com...]
I'm not very familiar with Windows tools for authoring UTF-8, but most web-orientated text editors (not Notepad) handle UTF-8 properly. Removing the BOM can be difficult as the characters are zero-width thus invisible, you may need to resort to a hex editor. If you have access to a Linux or *nix machine, the
iconv utility usually handles conversion between different character encoding flawlessly.