You are here: files saved in UTF-8, PHP5 sends UTF-8 BOM ;( « PHP Programming Language « IT news, forums, messages
files saved in UTF-8, PHP5 sends UTF-8 BOM ;(

Posted by R on 07/24/06 15:55

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(setlocale(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(setlocale(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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация