Why do i get some acsii chars displayed everytime i use require()?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rsbgm
    New Member
    • Mar 2009
    • 23

    Why do i get some acsii chars displayed everytime i use require()?

    I have been doing PHP sites with a command before the first HMTL headers requiring a 'paging.php' file with no problems at all... by using require() command and is right after the session_start() command, and, of course is in between the <?php ?>. I never had a problem until now. The latest site I'm making is displaying some ascii chars "¡»¿" evertime I use the require() or include() command. And I can't seem to find out what's wrong. I'd appreciate your advises...

    REY
  • Sudaraka
    New Member
    • Jan 2011
    • 55

    #2
    This could be a problem in the encoding type used when saving the .php files.
    Check the encoding type using an editor that supports it (i.e. Notepad++ or Geany). Set it to UTF-8 and see if you can fix the problem.

    Comment

    • rsbgm
      New Member
      • Mar 2009
      • 23

      #3
      Hi Sudaraka,

      Thanks for the advise.

      It's currently set to UTF-8. Now that you have mentioned that, I tried the other setting but the extra line with the ascii chars are still present in the browser.

      I'm still stuck here.

      REY

      Comment

      • Sudaraka
        New Member
        • Jan 2011
        • 55

        #4
        When you are saving as UTF-8, make sure you are saving without the BOM (Byte Order Mask), that's the 3 byte that show up in the browser (Hex EF BB BF).

        BOM appear on the browser when you send text from UTF-8 encoded file to the browser but your HTTP header or the HTML META tag instruct the browser to render it as iso-8859-1 or something else, so you could get rid of it by changing the encoding type on those places also.

        Comment

        • rsbgm
          New Member
          • Mar 2009
          • 23

          #5
          Hi Sudaraka,

          That was weird. I thought I have tried both w/ and w/o BOM. I must have missed a certain mixed. But, you are so right! I saved both the index.php and the paging.php file using UTF-8 (w/o BOM) type encoding... and viola! It disappeared!

          Thank you very mucho!

          REY

          Comment

          • Sudaraka
            New Member
            • Jan 2011
            • 55

            #6
            Good to hear you got it to work. Glad to help.

            Comment

            Working...