What is this string: Ôªø and how do I avoid it?

invisible, php, string

Solution

That's UTF-8 byte order mark (look for EF BB BF). This is a standard thing and shouldn't cause you problems, but if it does then make sure your source code editor doesn't prepend the file with BOM when saving it.

Problem

Somehow I managed to stick Ôªø at the top of a PHP script. What is that horrifying group of characters, how could I have entered it, and how can I expose and/or avoid it in the future? Anecdotally, it was lurking at the very top of a PHP script, before `<?php`. The script needed to send a Content-type header. Because Ôªø pushed the header off the top of the file, the server kept sending its own header, and 2 hours of hilarity ensued. I couldn't even see the string in nano or bash. But I redirected a diff and there it was.

Original source