files saved in UTF-8, PHP5 sends UTF-8 BOM ;(

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

    files saved in UTF-8, PHP5 sends UTF-8 BOM ;(

    Hi All,

    I'm using UTF-8 encoding for my PHP scripts, output is also UTF-8.

    all files have UTF-8 BOM: 0xEF 0xBB 0xBF at the beginning

    I have PHP Version 5.1.2 on WinNT and PHP 5.1.1 on Gentoo

    given code:

    if (PHP_OS == 'WINNT')
    {
    header('Content-Type: text/plain; charset=UTF-8"');
    var_dump(setloc ale(LC_ALL, 'polish_Poland' ));
    echo mb_strtoupper(" aesz", 'utf-8');
    }
    else
    {
    // this won't work BOM was sent -headers were sent
    header('Content-Type: text/plain; charset=UTF-8"');
    var_dump(setloc ale(LC_ALL, 'pl_PL.utf8'));
    echo mb_strtoupper(" aesz", 'utf-8');
    }

    the output is:

    WinNT:

    string(18) "Polish_Poland. 1250"
    AESZ

    Linux Gentoo:

    Warning: Cannot modify header information - headers already sent by
    (output started at /home/xh/public_html/test.php:1) in
    /home/rr/public_html/test.php on line 25
    string(10) "pl_PL.utf8 " AESZ

    mb_strtoupper works fine on both systems but what about
    PHP complaining about UTF-8 BOM when trying to send headers on
    Gentoo...

    on WinNT I have a newer version of PHP...
    is this error showing up because on Gentoo I use older PHP5?

    thanks in advance for any help

    best regards
    R

  • Andy Hassall

    #2
    Re: files saved in UTF-8, PHP5 sends UTF-8 BOM ;(

    On 24 Jul 2006 08:55:45 -0700, "R" <ruthless@poczt a.onet.plwrote:
    >I'm using UTF-8 encoding for my PHP scripts, output is also UTF-8.
    >
    >all files have UTF-8 BOM: 0xEF 0xBB 0xBF at the beginning
    >
    >I have PHP Version 5.1.2 on WinNT and PHP 5.1.1 on Gentoo
    See: http://bugs.php.net/bug.php?id=22108

    --
    Andy Hassall :: andy@andyh.co.u k :: http://www.andyh.co.uk
    http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

    Comment

    Working...