Help - Search - Members - Calendar
Full Version: include inserting gap in IE 6
HTMLHelp Forums > Programming > Server-side Scripting
asmith
hi

i struggled with a piece of code for like 3 hours, then i decided to delete everything to find out what's the problem.

this simple code :
CODE
<?php
include('anyfile.php');
echo '
<html>
<body>
<table border="10">
<tr><td>asdas</td></tr></table>
</body>
</html>';
?>


If this file is saved in ANSI , everyting goes right.
IF this file is saved in UTF-8 (as i'm using arabic characters i have to save it on UTF-8), the include line inserts gap at the top of the page. a white line with a height of 5 maybe, that i killed myself to remove, it won't go unless i remove the include line. (i've tried all body margin , padding to 0 . it is not part of the html i guess)
What should i do ? ??? ??? ??? (it all happens in IE 6. FF is fine about it)
Darin McGrew
Can you provide the URL (address) of a document that demonstrates the problem?
Christian J
Some text editors insert a BOM when you save as UTF-8, maybe that's causing problems? See e.g. http://juicystudio.com/article/utf-byte-order-mark.php

It may also depend on the content of "anyfile.php".
pandy
To make it clear, the include directive doesn't do it. What's in 'anyfile.php' does. As Darin said, a URL would be helpful.
asmith
anyfile.php contains the main site base which will be include in every page.


check this page, look at the top , there's gap between the table and tio o the browser in IE 6. FF got no proglem.

http://www.7gardoon.com/chat.php


the file is saves as UTF-8.


Anyfile.php here is including every content in body, except body tags. it is included in the body tags.

@christian , yea BOM is good sot for this, i've download textedit ,and editpad pro. i opened and save as my files there, not sure but i guess their all default was "not including BOM" , so i just saved my files with those programs again , but still no success.
Frederiek
Maybe the FAQ at unicode.org can throw some light on this UTF-8 no BOM, see http://unicode.org/faq/utf_bom.html.
asmith
yes, i read a few articles too , it is all about BOM.

I've tried some programs to remove it, but didn't succeed, any program you suggest for removing these BOMs ?
Frederiek
On PC I don't know. On Mac, use BBEdit or its free counterpart TextWrangler (http://www.bbedit.com), which allows you to specify the encoding even before saving. At the bottom of the file window in either app, you'll see an encoding menu.


asmith
I've try EditPad , UltraEdit and textEdit , none worked.

In W3 site it has written you can use a symple program that shows te BOMs and simply edit them by hand, but i can't seem to find this "simple program" . :/
asmith
I found the progam , solved ! the process to find it took about 8 hours!

the name of the progrmam : EmEditor

Christian J
Just in case: seems a BOM is inserted both before the Doctype and between the opening BODY tag and the TABLE, maybe the latter BOM is causing the gap before the table.

BTW, does anyone know if a BOM before the Doctype puts IE6 in quirks mode?

Also the first SCRIPT element is in upper case, which is not allowed in XHTML.
pandy
QUOTE(Christian J @ Jun 11 2008, 05:28 PM) *

BTW, does anyone know if a BOM before the Doctype puts IE6 in quirks mode?


I don't know but I assume it does.
Christian J
Had to test, and it seems at least IE7 doesn't let a BOM before the Doctype put it into quirks mode. But don't take my word for it, these things make me dizzy. blink.gif
asmith
QUOTE(Christian J @ Jun 11 2008, 10:28 AM) *

Just in case: seems a BOM is inserted both before the Doctype and between the opening BODY tag and the TABLE, maybe the latter BOM is causing the gap before the table.



that is true, how did you find out about those 2 BOMS ? what program did you (if you did) to open the file and check the BOMs ?
Christian J
QUOTE(asmith @ Jun 12 2008, 06:27 AM) *

how did you find out about those 2 BOMS ? what program did you (if you did) to open the file and check the BOMs ?

First I used http://rexswain.com/httpview.html --currently it only shows the BOM before the Doctype (the "EF,BB,BF"), not the second one.

You should also be able to see the BOM if you open a file in TextPad, with File format set to Binary in the Open dialog. But, if I view source of http://www.7gardoon.com/chat.php in TextPad and save it, TextPad seems to remove the BOM. It seems I must view first source and save with e.g. Notepad to retain the BOM, then open the saved file with TextPad in Binary. wacko.gif
Brian Chandler
QUOTE
It seems I must view first source and save with e.g. Notepad to retain the BOM, then open the saved file with TextPad in Binary.


How do you do that? I mean, don't you save the file in your browser? (Or browser-like-OS-component, if that's your fancy?)
Christian J
QUOTE(Brian Chandler @ Jun 12 2008, 01:20 PM) *

don't you save the file in your browser? (Or browser-like-OS-component, if that's your fancy?)


I recall MSIE used to(?) change the content of web pages when using the "Save As"-dialog, so I always open in a text editor out of habit, even when using Opera. AFAIK Safari or Firefox don't let you view source in a text editor of your own choice.
Brian Chandler
QUOTE(Christian J @ Jun 13 2008, 12:39 AM) *

QUOTE(Brian Chandler @ Jun 12 2008, 01:20 PM) *

don't you save the file in your browser? (Or browser-like-OS-component, if that's your fancy?)


I recall MSIE used to(?) change the content of web pages when using the "Save As"-dialog, so I always open in a text editor out of habit, even when using Opera. AFAIK Safari or Firefox don't let you view source in a text editor of your own choice.


Problem is that the same text editor may be "helping" (in the Very Modern sense) by changing things around for you. Best to use wget in that case.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.