Jump to content

Why do I get "" all over my page?


CreepinJesus

Recommended Posts

I'm new to PHP; so, if you reply, could you be fairly explanatory, please :)

 

I have a basic page that has two includes.  The included files are .htm files (basically a header and footer for the page).  However, in their positions, the page displays  a line above the include.  What is this?  Does it mean something's messed up?

Link to comment
Share on other sites

I've had weird problems with PHP files that are encoded in UTF-8 or Unicode, so that might be it....  Try using ANSII as the encoding, and see if the weird chars go away.

 

Actually, I don't remember which char set the one you said is....  Hmmmm lol....

 

Anyway, to change/see the encoding, open it in notepad, go to save as, and look at the encoding.

Link to comment
Share on other sites

Actually php has the ability to handle non-latin characters, but its not easy, and involves enabling the double byte character library using your php.ini file, and then setting the settings a proper way. I have never done it with Chinese or Russian, but I currently program sites in Japanese and have had to do it for Japanese character encoding. Its not easy by any means, but it can be done.

Link to comment
Share on other sites

Do you guys know what you're talking about? His problem is caused because of the BOM (Byte Order Mark). When saving a file in UTF-8 encoding, the BOM is automatically added at the start of the file. And then if the encoding is set wrong somewhere, the BOM will display. From Wikipedia:

 

The UTF-8 representation of the BOM is the byte sequence EF BB BF, which appears as the ISO-8859-1 characters "" in most text editors and web browsers not prepared to handle UTF-8.

 

And for all I know, it's perfectly cool to serve odd characters (that is non ISO-8859-1) with PHP, as long as you remember to tell both the actual file AND the browser (via (X)HTML) that the encoding should be UTF-8. And it is really recommended to use UTF-8 as encoding these days. I use the open-source text editor Notepad++ for all my writing/editing of files, and in that program you can choose to save your file as UTF-8 WITHOUT the annoying (and unnecessary) BOM. So my advice to everyone actually, is to use UTF-8 as encoding (without the BOM) and remember to:

 

  • Save your file as UTF-8 (remember to choose this encoding from the start, otherwise look into converting from ISO-8859-1 to UTF-8).
  • Specify the encoding in your (X)HTML file, with the right meta tag:

<meta http-equiv="content-type" content="text/html; charset=utf-8" />

 

That way everything should work as intended :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.