0

Possible Duplicate:
Headers already sent by PHP

I have two files to test this issue

test-ansi.php    (75 bytes)    
test-utf.php     (78 bytes)    

Both were saved with notepad++ using ansi charset and utf charset in each case.
Both have the same content:

<?php


header('Content-Type: text/javascript; charset=utf8');



//

test-ansi.php works fine test-utf.php throws the error: Warning: Cannot modify header information - headers already sent by (output started at /home/unodev/public_html/oo/test-utf.php:1) in /home/unodev/public_html/oo/test-utf.php on line 4
The point is that i need the script (and some includes) coded in utf-8 charset.
What can I do?
Thanks in advance

Community
  • 1
  • 1
Saic Siquot
  • 6,513
  • 5
  • 34
  • 56

2 Answers2

4

You should save utf-8 file as "UTF8 without BOM" in notepad++.

Electronick
  • 1,122
  • 8
  • 15
3

Given the utf8 script's output warning is at line 1, you've probably got something in the file BEFORE the script's opening <? php tag, possibly a unicode BOM.

Marc B
  • 356,200
  • 43
  • 426
  • 500
  • I guess I have 3 "invisible" chars as it is shown by they size but they aren't editable (or removible) – Saic Siquot Feb 22 '12 at 20:59
  • use a text editor that lets you choose text formats. e.g. in Notepad make sure the encoding is "ansi" and not utf/unicode. that should strip the BOMs. – Marc B Feb 22 '12 at 21:02
  • but I need utf. the code shown is a reduction of the real problem – Saic Siquot Feb 22 '12 at 21:05
  • then use UTF8 without BOM (you can set that in Notepad++ or any other text editor worth its salt) – Daan Feb 22 '12 at 21:40