Problem with include causing unwanted space

6

I'm creating a page with some includes ( top and footer ) and where I put these includes appears a huge space with a strange code (% code) (the code does not appear on the page, only in the browser element inspector):

Look at the image above that appears between &#65279; and <main> , for example. The same thing happens everywhere I put include.

I'm doing it this way:

<body>
<?php
include 'aa_topo.php';
?>
<main>
   <!-- conteúdo HTML -->   
</main>
<?php
include 'aa_footer.php';
?>
</body>
</html>

In the source code of the page everything is normal, nothing strange appears, but where includes is creating a vertical spacing of 50px between one element and another (between <footer> and body and between main and main ).

If I put the includes tags right on the page, everything will be fine.

What is causing this and how can I resolve it?

I'm using a temporary server with PHP 5.2.17 and DreamWeaver CC 2015.

    
asked by anonymous 02.08.2018 / 01:26

1 answer

6

The problem you mentioned is the result of two special characters used in UTF to indicate the order of bytes.

They are called Byte Order Mark (BOM). In hexadecimal, they are the sequence 0xFEFF or 0xFFFE, depending on the endianness of the file.

In UTF-16 the BOM is necessary to determine the order of the bytes, but in UTF-8 its use is not recommended (and does not make sense since it is a sequential format)

To learn more about BOM :

  

What is Unicode Subscription (BOM)


Specific solution for DreamWeaver:

To disable this inclusion in UTF-8 files in the editor mentioned, disable this checkbox (or equivalent, in the version you are using):

DescriptioninPortuguese,ontheAdobepage:

  

Configure a page's encoding and title properties

    
02.08.2018 / 02:04