Xairro.com

UTF-8-Signatur und PHP

Hallo! Ich habe ein unheimliches Problem: Ein UTF-8-Dokument hat die Signatur aus den 3 Bytes 0xEF 0xBB 0xBF wie ihr wahrscheinlich wisst. Aber PHP kommt damit nicht zurecht, das ist sowas von ätzend. Wenn ich beispielsweise in einer PHP-Datei, die UTF-8 kodiert ist, folgendes stehen habe, gibt es eine Warnung:

<?php header('Content-Type: text/html; charset=utf-8'); ?>

Die Warnung ist "header already sent", wie nicht anders zu erwarten. Gibt es keine Möglichkeit das das Problem zu beheben?


Schokolade! Ich bin root, ich darf das.

Rating: 0 Permalink
  • Julian
  • Avatar
  • Jan. 24, 2008, 1:58 p.m.

Typisches PHP Problem. BOM in UTF-8 sucks. Zu PHP sag ich jetzt nichts.

Datei mit Hex-Editor öffnen und BOM löschen.

Edit: http://bugs.php.net/bug.php?id=22108


There are only 10 types of people in the world: Those who understand binary, and those who don't.

Rating: 0 Permalink