Problem with include causing unwanted space

Asked

Viewed 148 times

6

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

inserir a descrição da imagem aqui

See in the image above what appears between the <main> and the <footer>, for example. The same thing happens everywhere I put the 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 have these includes is creating a 50px vertical spacing between one element and another (between the body and main and between the main and the footer).

If I put the codes includes right on the page, everything is normal.

What’s causing this and how I can fix it?

I’m using a temporary server with PHP 5.2.17 and Dreamweaver CC 2015.

  • show aa_footer.php as well

  • 1

    cara has a similar question here already https://answall.com/questions/92639/65279-aparece-esse-erro-entre-o-body-e-d%C3%A1-diff%C3%A7a-de-espa%C3%A7o

  • Uncle sam, Voce must have copied some code in Unicode and pasted on your page.

  • @Grandpa Leocaracciolo, no. I created in Dreamweaver same

  • 2

    Boy there’s nothing GOOD in this thing, only BAD even kkkk

  • This happened to me several times, I pasted directly on Frontpage and appeared these strange things

  • 3

    +1 for the joke. Download Notepad++, go to formatting and select (UTF8 NO GOOD)

  • @VME, this is how I do when I face the problem.

Show 3 more comments

1 answer

6

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

Are called Byte Order Mark (GOOD). In hexadecimal, they are the sequence 0xFEFF or 0xFFFE, depending on the endianness of the archive.

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

To learn more about the GOOD:

What use is Unicode signature (GOOD)


Specific solution for Dreamweaver:

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

Screenshot da página de configuração do editor

Description in Portuguese, on the Adobe page:

Set encoding and title properties of a page

Browser other questions tagged

You are not signed in. Login or sign up in order to post.