{"action":"created","issue":{"url":"https://api.github.com/repos/squizlabs/PHP_CodeSniffer/issues/534","labels_url":"https://api.github.com/repos/squizlabs/PHP_CodeSniffer/issues/534/labels{/name}","comments_url":"https://api.github.com/repos/squizlabs/PHP_CodeSniffer/issues/534/comments","events_url":"https://api.github.com/repos/squizlabs/PHP_CodeSniffer/issues/534/events","html_url":"https://github.com/squizlabs/PHP_CodeSniffer/issues/534","id":67072205,"number":534,"title":"Generic.Files.LineLength should count line width instead of char counts","user":{"login":"pokehanai","id":1510461,"avatar_url":"https://avatars.githubusercontent.com/u/1510461?v=3","gravatar_id":"","url":"https://api.github.com/users/pokehanai","html_url":"https://github.com/pokehanai","followers_url":"https://api.github.com/users/pokehanai/followers","following_url":"https://api.github.com/users/pokehanai/following{/other_user}","gists_url":"https://api.github.com/users/pokehanai/gists{/gist_id}","starred_url":"https://api.github.com/users/pokehanai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pokehanai/subscriptions","organizations_url":"https://api.github.com/users/pokehanai/orgs","repos_url":"https://api.github.com/users/pokehanai/repos","events_url":"https://api.github.com/users/pokehanai/events{/privacy}","received_events_url":"https://api.github.com/users/pokehanai/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-04-08T07:55:40Z","updated_at":"2015-04-08T09:55:03Z","closed_at":"2015-04-08T09:55:03Z","body":"Currently `phpcs --encoding=utf8` checks line length by number of characters.\r\nBut while the rule is for readability for human, it should care of display width of each line.\r\n\r\nPHP has [mb_strwidth()][] for this situation.\r\n[mb_strwidth()]: http://php.net/mb_strwidth\r\n\r\n| line   | current | expected |\r\n| :---   |     --: |      --: |\r\n| aaa    |       3 |        3 |\r\n| ☆☆☆ |       3 |        6 |"},"comment":{"url":"https://api.github.com/repos/squizlabs/PHP_CodeSniffer/issues/comments/90866497","html_url":"https://github.com/squizlabs/PHP_CodeSniffer/issues/534#issuecomment-90866497","issue_url":"https://api.github.com/repos/squizlabs/PHP_CodeSniffer/issues/534","id":90866497,"user":{"login":"gsherwood","id":185976,"avatar_url":"https://avatars.githubusercontent.com/u/185976?v=3","gravatar_id":"","url":"https://api.github.com/users/gsherwood","html_url":"https://github.com/gsherwood","followers_url":"https://api.github.com/users/gsherwood/followers","following_url":"https://api.github.com/users/gsherwood/following{/other_user}","gists_url":"https://api.github.com/users/gsherwood/gists{/gist_id}","starred_url":"https://api.github.com/users/gsherwood/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gsherwood/subscriptions","organizations_url":"https://api.github.com/users/gsherwood/orgs","repos_url":"https://api.github.com/users/gsherwood/repos","events_url":"https://api.github.com/users/gsherwood/events{/privacy}","received_events_url":"https://api.github.com/users/gsherwood/received_events","type":"User","site_admin":false},"created_at":"2015-04-08T09:55:03Z","updated_at":"2015-04-08T09:55:03Z","body":"Sorry, but this isn't something that I can do.\r\n\r\nLetters and symbols do not have sizes; they are only character codes. The font you choose gives them their size (specifically their width, in your case). There is no way to look at a character and determine the width.\r\n\r\nIf you have a very specific use case, you can always write a custom sniff that takes in account the specific characters you use and the font and font size you typically use, to estimate line width. But it's not something I would ever consider doing in the Generic line length sniff.\r\n\r\n"}}