You are here: Re: include generates unexpected control character « PHP Programming Language « IT news, forums, messages
Re: include generates unexpected control character

Posted by Csaba Gabor on 12/06/07 11:21

R.A.M. wrote:
> Hello,
> I have little experience in PHP so I would like to ask a question. I use
> PHP5 in Windows XP Professional, Apache 2.0.59.
> I have created a website with index.php file. This file contains:
> <ul>
> <?php include('Menu/Association.inc'); ?>
> </ul>
> The file Menu/Association.inc starts with:
> <li><a href="Association.php">Strona Stowarzyszenia</a></li>
> (I mean before <li> there are no characters, "<" is first byte of the file).
> Unexpectedly in a browser I noticed additional space. When I view source I
> see in Notepad strange character between <ul> and <li> - Notepad shows it as
> square box so I guess that it is a control character, ASCII < "!".
> I tried to use readfile() instead of include() but with the same result.
> Both files, index.php and Menu/Association.inc, are encoded using UTF-8 (I
> have veryfied).

Are you talking, perhaps, about the newline followed by
3 spaces that you yourself have inserted by separating the <ul>
from the <?php by exactly that much?

Double check by looking at the hex values (with php, of course!)
$text = file_get_contents("pathToFileGoesHere");
$max = strlen($text); // or put in your own maximum
for ($i=0;$i<$max;++$i) {
// Now show the bytes or their ascii codes
$ord = ord($chr=$text[$i]);
if ($chr>="A" && $chr<="Z") $ord = $chr;
else if ($chr>="a" && $chr<="z") $ord = $chr;
else if ($ord==32) $ord = "space";
print "$ord "; }


Csaba Gabor from Vienna

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация