kenrbnsn Posted July 11, 2010 Share Posted July 11, 2010 Are you using an editor that stores the files as UTF-8. If you are make sure you are storing them without the BOM marker. That can screw things up royally. Ken Quote Link to comment Share on other sites More sharing options...
myrddinwylt Posted July 11, 2010 Share Posted July 11, 2010 Yes, I am just saying it's bad practice, even though it is something generally used. If the file is 100% pure HTML, the why not use SSI. Include will work, but opens a whole can of potential problems (such as if your html gets 'infected' through an exploit of just this method). Code like ">>" also are interpreted, the list goes on. file_get_contents() / echo combination doesn't allow for interpretation of inserted code. As for PHP_kid's problem in OP, I believe that it does lie within the IE6 style statements as Pikachu2000 pointed out. I am confident you will notice the problem and help the OP resolve this issue though. Was simply pointing out bad practice as "include" does open a whole can of worms best left closed to internal code execution only. Ok. I have taken the OP's code and put it on my server. It seems to work fine in the three browsers I tested: IE8, FF 3.6.6 and Chrome 5.0.375.86. The URL on my server to test it is: http://www.rbnsn.com/phpfreaks/php_kid/ Ken Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted July 11, 2010 Share Posted July 11, 2010 I hope you aren't using Notepad as an editor. If you are, that's probably the whole problem. Quote Link to comment Share on other sites More sharing options...
myrddinwylt Posted July 11, 2010 Share Posted July 11, 2010 For odd characters, you could try switching your header to something like the following <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Your Site Name</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> This also helps with some compatability issues with CSS (W3 Transitional), and the meta http-equiv, tells the browser to display UTF-8 chars properly. Quote Link to comment Share on other sites More sharing options...
myrddinwylt Posted July 11, 2010 Share Posted July 11, 2010 As for the char at the very beginning, not sure why that is happening outside of the editor, or something funky the "include" command is doing to it. To be safe that it isn't the "html" file you are including, try removing that char using the following free editor: Notepad++ If the character is not in the "html" file when opening with that program, then there is something happening during the "include" process which is adding it. Good luck you guys thnx Ken. that works in all of my browsers......... so that leads me to believe the PHP running at NetSol is whacked.... it is confirmed, the issue seems to be the 1st byte of my src after calling index.php, the 1st byte is a special char (unix line break, the small box symbol), see attached pic. when i copy out the src it was removing this char, hence why it then worked. so why do i get a special char as 1st byte?? i'm gonna try a different text editor.... Quote Link to comment Share on other sites More sharing options...
PHP_kid Posted July 11, 2010 Author Share Posted July 11, 2010 my F'in editor !!!!! M'fer M'fer. thnx all for your help. i use UltraEdit, was saving docs as utf-8 with default line terminator with BOM. i copied everything into notepad and saved as ansi and it now works fine. it was the index.php that was causing the problem. i will try Uedit with utf-8 no BOM. Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted July 11, 2010 Share Posted July 11, 2010 I use UltraEdit also. I turned off the BOM. Ken Quote Link to comment Share on other sites More sharing options...
PHP_kid Posted July 11, 2010 Author Share Posted July 11, 2010 I use UltraEdit also. I turned off the BOM. Ken yes, that also works. man, what a frustrating issue. when i do a view src from IE it will open in Uedit, then all i did was do a file save as, but i didnt notice it was saving that file as ansi/ascii. it all makes sense now. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.