utf-8 problems

Creating and modifying plugins.
Post Reply
User avatar
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

utf-8 problems

Post by Timbalu » Mon Sep 28, 2009 6:41 pm

It took me quite a long time to find out, who is making the trouble...!

If you encounter troubles coding (on your local windows server) like

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /somewhere/utf-8/lang_de.inc.php:1) in /somewhere/utf-8/lang_de.inc.php on line 1

an use a editor for your scripts, make sure you save it as UTF-8 without BOM, likely if you use Notepad++. I changed my editor to its newest version, so I didn't know it. I had the directive to save the file as utf-8, you could also (better) use ANSI without having the BOM problem. Maybe this is helpful for someone to save some time... ;-)

Ian

See:

http://de.wikipedia.org/wiki/Byte_Order_Mark
http://www.w3.org/International/questions/qa-utf8-bom.de.php

and a (unproved) script to remove on linux

remove the Unicode Byte-Order Mark (BOM) from all your files... to find them on a linux box do the following:

Code: Select all

find /path/to/editor -type f | while read line; do hd "$line" | grep -q 'ef bb bf' && echo "$line"; done > listOfBOMedFiles.txt


to remove them then:

Code: Select all

cat listOfBOMedFiles.txt | while read line; do dd if=$line of=$line.noBOM ibs=3 skip=1; mv $line.noBOM $line; done

Post Reply