php doesn't ignore the utf-8 BOM

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Vedran F.

    #1

    php doesn't ignore the utf-8 BOM

    "When a php file is saved in utf-8 format with the UTF-8 BOM as the first
    three bytes of the file (EF BB BF), PHP doesn't ignore these bytes when
    loading and compiling the file, but instead considers them output coming
    prior to the <?php. This causes incorrect display of the page and
    failure of any http header output."

    I have this problem, I'm from croatia and I must use unicode (with php) but
    php have this bug.
    Is there a solution??


  • Jan Oetjen

    #2
    Re: php doesn't ignore the utf-8 BOM

    In article <bervoc$2np$1@b agan.srce.hr>, vedranf@rijeka. riteh.hr says...[color=blue]
    >
    > I have this problem, I'm from croatia and I must use unicode (with php) but
    > php have this bug.
    > Is there a solution??[/color]

    I just made my website based on UTF-8 and XHTML. The only problem I ran
    into was that PHP seems to dislike the firstline, the xml declaration:

    <?xml version="1.0" encoding="utf-8"?>

    The solution is to simply let php output the code:

    <?php echo "<?xml version=\"1.0\" encoding=\"utf-8\"?".">"; ?>

    But since you seem to have another problem it sounds to me like possibly
    your webserver has some problems with the unicode. I am running apache.

    Don't know I that helps you, but I had to mention.

    jan
    --
    ....and thanx for the fish!

    Comment

    • Vedran F.

      #3
      Re: php doesn't ignore the utf-8 BOM

      > But since you seem to have another problem it sounds to me like possibly[color=blue]
      > your webserver has some problems with the unicode. I am running apache.[/color]

      apache? me too
      no, it's a universal problem with php <http://bugs.php.net/bug.php?id=2210 8>
      huge bug if u ask me
      Files in utf have 3 bytes in the beginning, before the first "<?php" and
      there is a problem, php thinks that this is output to browser and cannot
      send headers


      Comment

      • Jan Oetjen

        #4
        Re: php doesn't ignore the utf-8 BOM

        In article <besntj$22k$1@b agan.srce.hr>, vedranf@rijeka. riteh.hr says...[color=blue][color=green]
        > > But since you seem to have another problem it sounds to me like possibly
        > > your webserver has some problems with the unicode. I am running apache.[/color]
        >
        > apache? me too
        > no, it's a universal problem with php <http://bugs.php.net/bug.php?id=2210 8>
        > huge bug if u ask me
        > Files in utf have 3 bytes in the beginning, before the first "<?php" and
        > there is a problem, php thinks that this is output to browser and cannot
        > send headers
        >
        >
        >[/color]

        Then it's most amusing that my UTF-8 Files do work as expected. They're
        working locally and online (try them at http://www.pixelfaculty.de/)
        with Opera, Netscape and Internet Explorer. Automatic Document Ecoding
        Detection tells me it is UTF-8, I can open the files with UltraEdit to
        check that they're UTF-8. And of course, all pages are using PHP. Even
        if I don't manipulate the header data I just tried it, and it works as
        expected.

        Sometimes web development is more than funny :D

        jan
        --
        ....and thanx for the fish!

        Comment

        • Vedran F.

          #5
          Re: php doesn't ignore the utf-8 BOM

          > Then it's most amusing that my UTF-8 Files do work as expected. They're[color=blue]
          > working locally and online (try them at http://www.pixelfaculty.de/)
          > with Opera, Netscape and Internet Explorer. Automatic Document Ecoding
          > Detection tells me it is UTF-8, I can open the files with UltraEdit to
          > check that they're UTF-8. And of course, all pages are using PHP. Even
          > if I don't manipulate the header data I just tried it, and it works as
          > expected.[/color]

          maybe UltraEdit did not add this 3 bytes (BOM) in file, some editors
          (dreamweaver) does add


          Comment

          Working...