EF BB BF

I fight 3 days to solve captcha problem in Drupal. After enabled Image Captcha in modules menu I discover that captcha did not render image. After some small investigation i found that image is rendered but browser cannot read it. After I wrote image to disk, I opened it with IrfanView and IrfanView showed me correct image. At this point i knew that there is something wrong with image header. My next step was to download some free hex editor so I can looked at image header and …….. I discovered that in my image there is some extra bytes at the beginnig of file and it was: EF BB BF. Some small research with google and voila. The EF BB BF was from file encoding. My index.php encoding was UTF8 so I have to change it to UTF8 without BOM. After 3 days fighting, 10s and my captcha start working.

Edit: 2010-03-27
Problem get back. Now I know that every php script in drupal have to be in UTF without BOM.
I found sh script that helped me:

1
find -type f|while read file;do [ "`head -c3 -- "$file"`" == $'\xef\xbb\xbf' ] && echo "found BOM in: $file";done

source