New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PSR1 doesn't check for file encoding #3841
Comments
The What I believe you are trying to report is that there is no sniff checking if files are encoded as UTF-8. While I do believe it can be checked what files claim to be encoded as, I do not believe it is possible to reliably verify that that claim is actually correct. I may well be wrong though and/or reality may have superseded the research I did in a distant past when I looked into something like this before. I'll mark this as a feature request for now and would be interested to hear if someone has found a way to do this. |
You're right. It's more a feature request than a bug. |
The PSR1 standard stands that "Files MUST use only UTF-8 without BOM for PHP code".
There is no check for files using other encodings than UTF-8. The existing sniff checks for BOM in the files.
If a file is encoded with, for example. windows-1252 encoding and don't have BOM, the file check pass.
Steps to reproduce the behavior:
test.php
with any code and file encoding different than UTF-8 and without BOMphpcs --standard=PSR1 test.php
Expected behavior
There should be an errors regarding the file enconding.
master
branch of PHP_CodeSniffer.The text was updated successfully, but these errors were encountered: