I was writing some commented PHP classes and I stumbled upon a problem. My name (for the @author tag) ends up with a ș (which is a UTF-8 character, ...and a strange name, I know).
Even though I save the file as UTF-8, some friends reported that they see that character totally messed up (È™). This problem goes away by adding the BOM signature. But that thing troubles me a bit, since I don't know that much about it, except from what I saw on Wikipedia and on some other similar questions here on SO.
I know that it adds some things at the beginning of the file, and from what I understood it's not that bad, but I'm concerned because the only problematic scenarios I read about involved PHP files. And since I'm writing PHP classes to share them, being 100% compatible is more important than having my name in the comments.
But I'm trying to understand the implications, should I use it without worrying? or are there cases when it might cause damage? When?
<?php die('test')at the top of an included PHP file was showing the UTF-8 BOM (these characters:) at the top of the file. It was difficult to figure out. That's when I discovered that one of the developers saved the file in Unicode, not ASCII, and this PHP couldn't read Unicoded PHP files. I started a fresh copy, copied data over and saved in ASCII, and the problem was resolved. Note that some FTP programs can do this to you, if you ever encounter this.iconv -f utf8 -t ascii old.php > new.phprepeatedly to detect all the Unicode problems, remove them, and save the page finally in ASCII with no errors form the iconv command. Once that was done, I noticed session vars held state between pages.