Strange characters above everything on a site, cant get rid of them.

Discussion in 'HTML & Website Design' started by jestep, Mar 14, 2006.

  1. #1
    I am redesigning a site for a customer and I just noticed something I have never seen before. The site used common header and footer templates, and on 2 of the pages there is a '' above everything on the entire document. It only happens in Firefox. Its above any php code and above the DOCTYPE declaration.

    Nothing about the 2 pages is different than any other.

    Has anyone seen this before or have any suggestions on how to fix it. It has nothing to do with the page names as I have tried renaming them. I have also tried removing all of the content, but still no change.

    Here's a bad page: http://test.jestep.com/contacts.php
    Here's a good one: http://test.jestep.com/accounts.php
     
    jestep, Mar 14, 2006 IP
  2. mariush

    mariush Peon

    Messages:
    562
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I think it may be the UTF-8 or UTF-16 BOM .. use Ultraedit or an advanced editor to remove the characters. If you check the files in Notepad, it will decode those characters, select the proper language and show you the content
     
    mariush, Mar 14, 2006 IP
  3. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #3
    That doesn't work because those characters are not on any page nor in the header. I would remove them, but they dont exist. I checked with notepad just to be sure. For some reason they just appear on those two pages. Its like the server is putting them there.
     
    jestep, Mar 14, 2006 IP
  4. mariush

    mariush Peon

    Messages:
    562
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #4
    It's hard to explain... guess I have to replicate your problem to prove what I'm trying to say:

    http://dev.helpedia.com/utf_example1.php

    and here's the source code of that page :

    http://dev.helpedia.com/utf_example1.zip

    File is saved as UTF-8 but, because you have specified in the header the Content-Type property to charset=iso-8859-1 , the browser treats the UTF BOM as text.

    Hope it helps you out. Check the php file in the zip with Ultraedit Hex Mode or any hex editor.
     
    mariush, Mar 14, 2006 IP
  5. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #5
    The UTF-8 is on the right track. I found a fix for it, but I wasn't able to fix the actual problem. I set my default charset to UTF-8 in htaccess, instead of iso-8859-1 which is what is it written using, and this fixed it.

    I do see what you're saying. I'm just trying to figure out how the extra characters got in there in the first place, and why they only appear on 2 pages even though everything is using the same header.
     
    jestep, Mar 14, 2006 IP
  6. nevetS

    nevetS Evolving Dragon

    Messages:
    2,544
    Likes Received:
    211
    Best Answers:
    0
    Trophy Points:
    135
    #6
    The characters identify the file as a unicode file. If you open the file up in a more robust text editor - such as ultraedit, you can convert the file.

    I ran into the problem myself with FCKEdit and I have problems editing those files in vi, but if I take it into ultraedit I don't have any problems.
     
    nevetS, Mar 14, 2006 IP
  7. kk5st

    kk5st Prominent Member

    Messages:
    3,497
    Likes Received:
    376
    Best Answers:
    29
    Trophy Points:
    335
    #7
    It's a problem with MS editors. You can save the page as iso-8859-1, or get a good editor. I can think of no sane reason to put a BOM on a utf-8 or utf-16 file, as both character sets are self-describing. It doesn't matter the Byte order.

    Additionally, since it comes before the DTD, it will throw IE into quirks mode, which is a Bad Thing®. If served as utf-8, you won't see it, but IE does, and there ya go.

    cheers,

    gary
     
    kk5st, Mar 14, 2006 IP