问题
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.
回答1:
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.
回答2:
That's most certainly an encoding error. Most likely, you're saving your script as one format, but uploading it or declaring it as another. I can't offer any further advice because I don't know much about encoding errors or how to fix them. Good luck squashing the bug.
来源:https://stackoverflow.com/questions/1837626/what-is-this-string-%c3%94%c2%aa%c3%b8-and-how-do-i-avoid-it