Collaborate without boundaries

<?php include(…) ?>: strange extra white space at the beginning of page

Development Romance

WPF, C# and Silverlight

<?php include(…) ?>: strange extra white space at the beginning of page

  • Comments 13

Well, recently i took my first steps with php, created a header, a footer, saved them as UTF-8 pages, and included them in each page. By the time i tested my web application for the first time, i recognized a strange extra white space at the beginning of each page, just like the following:

php_white_space

I began checking my css rules and my javascript scripts, but none of these had anything to do with this feature. My next step was to search the internet for a similar case. What i found is that if you choose to save your pages as UTF-8, a special signature is also included at the beginning of the file, indicating that it is a UTF-8 file. Hopefully, we can remove that signature without problem, but it isn’t recognised by every editor, only the “low-level” ones are capable of showing the signature. I opened my file with the edit command of the DOS command prompt:

php_utf8

As you can see, a chunk of bytes is included at the beginning of the file, i deleted it, saved and all my problems were solved.

Now my page looks like this:

php_no_white_space

I hope this helps. Have a happy new year’s eve !!

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • Post
Page 1 of 1 (13 items)
Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • Post