Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #17853

Re: Twice UTF-8 byte-order mark (BOM)

From "J.O. Aho" <user@example.net>
Newsgroups comp.lang.php
Subject Re: Twice UTF-8 byte-order mark (BOM)
Date 2018-12-24 20:54 +0100
Message-ID <g8crr4FbuomU1@mid.individual.net> (permalink)
References <82a7cd23-82be-4611-a691-e0edcf8c30d6@googlegroups.com> <241220181649060212%timstreater@greenbee.net> <5c212055$0$22357$e4fe514c@news.xs4all.nl>

Show all headers | View raw


On 12/24/18 7:07 PM, Luuk wrote:
> On 24-12-2018 17:49, Tim Streater wrote:
>> In article <82a7cd23-82be-4611-a691-e0edcf8c30d6@googlegroups.com>,
>> <vfhhutt45hghjjdewrghb@gmail.com> wrote:
>>
>>> I'm not sure if it is a bug, feature or what ever and if this is the
>>> correct
>>> group. Just for the archive:
>>>
>>> In my script I create a file and offer it for downloading. But in the
>>> downloaded file was theĀ  UTF-8 byte-order mark (BOM) twice at the
>>> beginning:
>>>> EF BB BF EF BB BF ...
>>>
>>> The code was:
>>> <?php
>>> include 'dbconfig.php';
>>> //... no output etc.
>>> header('Content-type: text/xml; charset=utf-8');
>>> header('Content-Disposition: attachment; filename="' . $titel .
>>> '.gpx"');
>>> print "Hello";
>>> exit();
>>> ?>
>>>
>>> The dbconfig.php did not create any blanks etc. only:
>>> <?php
>>> $db_server = "xx";
>>> $db_user = "xx";
>>> ?>
>>>
>>> I figured out the problem: The dbconfig.php was saved as UTF-8 with 1
>>> BOM at
>>> beginning. It seems that this BOM was added with include. After I
>>> delete the 3
>>> first Bytes from the dbconfig.php everything works fine and only 1
>>> BOM is in
>>> the downloaded file.
>>
>> If it's UTF-8 you don't need *any* BOM in the file.
>>
> 
> Also specifying two-BOM's should not make the file invalid, unless
> there's some CRC code to check if its valid (probably only in executable
> files?)
> 
> Back to the subject:
> I do not think this is a bug in PHP, but a 'bug' in your application.
> Everythin PHP has done, is done accourindg to definition.
> 
> BTW: Then only thing PHP can do is add this to their docs (if its not
> already in the docs): YOU should make sure not any of your PHP-files
> starts with a BOM
> 
I would suggest that the BOM is the bug and shouldn't have been accepted
as part of the UTF-8 standard.

-- 

 //Aho

Back to comp.lang.php | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Twice UTF-8 byte-order mark (BOM) vfhhutt45hghjjdewrghb@gmail.com - 2018-12-24 08:39 -0800
  Re: Twice UTF-8 byte-order mark (BOM) Tim Streater <timstreater@greenbee.net> - 2018-12-24 16:49 +0000
    Re: Twice UTF-8 byte-order mark (BOM) Luuk <luuk@invalid.lan> - 2018-12-24 19:07 +0100
      Re: Twice UTF-8 byte-order mark (BOM) "J.O. Aho" <user@example.net> - 2018-12-24 20:54 +0100
        Re: Twice UTF-8 byte-order mark (BOM) Luuk <luuk@invalid.lan> - 2018-12-24 21:15 +0100
      Re: Twice UTF-8 byte-order mark (BOM) Arno Welzel <usenet@arnowelzel.de> - 2018-12-26 09:13 +0100
        Re: Twice UTF-8 byte-order mark (BOM) Luuk <luuk@invalid.lan> - 2018-12-26 12:41 +0100
          Re: Twice UTF-8 byte-order mark (BOM) Arno Welzel <usenet@arnowelzel.de> - 2018-12-26 15:32 +0100
        Re: Twice UTF-8 byte-order mark (BOM) "J.O. Aho" <user@example.net> - 2018-12-26 15:41 +0100
          Re: Twice UTF-8 byte-order mark (BOM) vfhhutt45hghjjdewrghb@gmail.com - 2019-01-04 08:29 -0800
            Re: Twice UTF-8 byte-order mark (BOM) Richard Damon <Richard@Damon-Family.org> - 2019-01-04 21:08 -0500
            Re: Twice UTF-8 byte-order mark (BOM) "J.O. Aho" <user@example.net> - 2019-01-05 11:04 +0100
              Re: Twice UTF-8 byte-order mark (BOM) Richard Damon <Richard@Damon-Family.org> - 2019-01-05 11:26 -0500
                Re: Twice UTF-8 byte-order mark (BOM) Tim Streater <timstreater@greenbee.net> - 2019-01-05 16:33 +0000
                Re: Twice UTF-8 byte-order mark (BOM) Luuk <luuk@invalid.lan> - 2019-01-05 19:34 +0100
                Re: Twice UTF-8 byte-order mark (BOM) Tim Streater <timstreater@greenbee.net> - 2019-01-05 19:08 +0000
                Re: Twice UTF-8 byte-order mark (BOM) Luuk <luuk@invalid.lan> - 2019-01-06 20:25 +0100

csiph-web