473,406 Members | 2,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

include generates unexpected control character

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 <lithere 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 <uland <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).
Could you help me please?
***Thanks***
/RAM/
Dec 6 '07 #1
4 3129
On Thu, 06 Dec 2007 07:35:01 +0100, R.A.M. <r_********@poczta.onet.pl
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 <lithere 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 <uland <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).
Could you help me please?
UTF-8 BOM that shouldn't be there? (EF BB BF)
--
Rik Wasmus
Dec 6 '07 #2
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 <lithere 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 <uland <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
Dec 6 '07 #3
Thanks.
I have checked the output using your program. It contains three additional
(not occuring in .php nor .inc) bytes (just before "<li>") with decimal
values: 239 187 191 (printable, non-English letters). Where are they from in
output? How to get rid of them?
/RAM/
Dec 6 '07 #4
Użytkownik "R.A.M." <r_********@poczta.onet.plnapisał w wiadomo¶ci
news:fj**********@news2.task.gda.pl...
It contains three additional (not occuring in .php nor .inc) bytes (just
before "<li>") with decimal values: 239 187 191 (printable, non-English
letters).
The sequence starts a place of usage of every <?php include... ?(a few
times in my .php file), as well as before initial <!DOCTYPE at the beginning
of output (three first bytes of output).
/RAM/
Dec 6 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: stiank81 | last post by:
Hi. I have a problem witch I assume there is an answear to....? I have several XML schemas, and they all have quiet a lot of definitions in common. They still have to be seperated into...
0
by: Tom Lee | last post by:
Hi, I'm new to .NET 2003 compiler. When I tried to compile my program using DEBUG mode, I got the following errors in the C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7 \include\xdebug...
5
by: David Mathog | last post by:
One thing that can make porting C code from one platform to another miserable is #include. In particular, the need to either place the path to an included file within the #include statement or to...
1
by: Minh | last post by:
I've just installed VS.NET 2003 on my Athlon XP 1800+. However I couldn't get any project with STL includes to compile even if I create a new empty project (and added #include <string>). It gave me...
5
by: Arjen | last post by:
Hi, The login control (<asp:Login) generates a HTML table. I have used my own template without table's. The control generates <table> ... my design(template) ... </table>. I don't like the...
8
by: vagos | last post by:
Can someone please tell me why i get the following error ?? The strange is that sometimes i get the error and sometimes not !! Also there is no syntax error on line 251 Warning: Unexpected...
14
by: Jon Rea | last post by:
I am currently cleaning up an application which was origainlly hashed together with speed of coding in mind and therefore contains quite a few "hacky" shortcuts. As part of this "revamping"...
2
by: Dimitri Furman | last post by:
SQL Server 2000 SP4. Running the script below prints 'Unexpected': ----------------------------- DECLARE @String AS varchar(1) SELECT @String = 'z' IF @String LIKE ''
3
by: Tom | last post by:
Hi all i have problem with include function in my code after change php4 to php5. after standard html code i put in html body <? include ("filename.php"); ?> and close body and html. With php4...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.