{"action":"created","comment":{"url":"https://api.github.com/repos/crystal-lang/crystal/pulls/comments/88783713","pull_request_review_id":9349209,"id":88783713,"diff_hunk":"@@ -0,0 +1,137 @@\n+# Provides methods that answer questions about unicode characters,\n+# and the `Unicode::CaseOptions` enum for special case conversions\n+# like turkic.\n+#\n+# There's no need to use the methods defined in this module\n+# because they are exposed in `Char` in a more convenient way\n+# (`Char#upcase`, `Char#downcase`, `Char#whitespace?`, etc.)\n+module Unicode\n+  # Options to pass to `upcase`, `downcase`, `uppercase?`\n+  # and `lowecase?` to control their behaviour.\n+  @[Flags]\n+  enum CaseOptions\n+    # Only transform ASCII characters.\n+    ASCII","path":"src/unicode/unicode.cr","position":14,"original_position":14,"commit_id":"1a81114bc363549fd58b9fefee0b6faba04f8dd3","original_commit_id":"1a81114bc363549fd58b9fefee0b6faba04f8dd3","user":{"login":"drhuffman12","id":594270,"avatar_url":"https://avatars.githubusercontent.com/u/594270?v=3","gravatar_id":"","url":"https://api.github.com/users/drhuffman12","html_url":"https://github.com/drhuffman12","followers_url":"https://api.github.com/users/drhuffman12/followers","following_url":"https://api.github.com/users/drhuffman12/following{/other_user}","gists_url":"https://api.github.com/users/drhuffman12/gists{/gist_id}","starred_url":"https://api.github.com/users/drhuffman12/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/drhuffman12/subscriptions","organizations_url":"https://api.github.com/users/drhuffman12/orgs","repos_url":"https://api.github.com/users/drhuffman12/repos","events_url":"https://api.github.com/users/drhuffman12/events{/privacy}","received_events_url":"https://api.github.com/users/drhuffman12/received_events","type":"User","site_admin":false},"body":":+1:","created_at":"2016-11-19T17:36:19Z","updated_at":"2016-11-19T17:36:36Z","html_url":"https://github.com/crystal-lang/crystal/pull/3560#discussion_r88783713","pull_request_url":"https://api.github.com/repos/crystal-lang/crystal/pulls/3560","_links":{"self":{"href":"https://api.github.com/repos/crystal-lang/crystal/pulls/comments/88783713"},"html":{"href":"https://github.com/crystal-lang/crystal/pull/3560#discussion_r88783713"},"pull_request":{"href":"https://api.github.com/repos/crystal-lang/crystal/pulls/3560"}}},"pull_request":{"url":"https://api.github.com/repos/crystal-lang/crystal/pulls/3560","id":94484447,"html_url":"https://github.com/crystal-lang/crystal/pull/3560","diff_url":"https://github.com/crystal-lang/crystal/pull/3560.diff","patch_url":"https://github.com/crystal-lang/crystal/pull/3560.patch","issue_url":"https://api.github.com/repos/crystal-lang/crystal/issues/3560","number":3560,"state":"open","locked":false,"title":"Make String and Char methods like downcase and upcase unicode aware","user":{"login":"asterite","id":209371,"avatar_url":"https://avatars.githubusercontent.com/u/209371?v=3","gravatar_id":"","url":"https://api.github.com/users/asterite","html_url":"https://github.com/asterite","followers_url":"https://api.github.com/users/asterite/followers","following_url":"https://api.github.com/users/asterite/following{/other_user}","gists_url":"https://api.github.com/users/asterite/gists{/gist_id}","starred_url":"https://api.github.com/users/asterite/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asterite/subscriptions","organizations_url":"https://api.github.com/users/asterite/orgs","repos_url":"https://api.github.com/users/asterite/repos","events_url":"https://api.github.com/users/asterite/events{/privacy}","received_events_url":"https://api.github.com/users/asterite/received_events","type":"User","site_admin":false},"body":"As the title says....\r\n\r\nPreviously:\r\n\r\n```cr\r\n\"un árbol\".upcase # => \"UN áRBOL\"\r\n\"ЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭЁЯЧСМИТЬБЮ\".downcase # => \"ЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭЁЯЧСМИТЬБЮ\"\r\n```\r\n\r\nNow:\r\n\r\n```cr\r\n\"un árbol\".upcase # => \"UN ÁRBOL\"\r\n\"ЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭЁЯЧСМИТЬБЮ\".downcase # => \"йцукенгшщзхъфывапролджэёячсмитьбю\"\r\n```\r\n\r\nThere's also support for the special case of turkic:\r\n\r\n```cr\r\n\"İI\".downcase(Unicode::CaseOptions::Turkic) # =>\"iı\"\r\n\"iı\".upcase(Unicode::CaseOptions::Turkic) # =>\"İI\"\r\n```\r\n\r\nThis is a breaking change, because I renamed and changed some methods. Specifically, `Char#uppercase?` now checks for unicode uppercase, and there's also `Char#ascii_uppercase?` that only checks that in the ASCII range. The same applies to `whitespace?` and `ascii_whitespace?`. This shouldn't affect existing code but it might make them just a tiny bit slower.\r\n\r\nI also renamed `Char#alpha?` to `Char#letter?` because that's the name used in unicode categories (this is the real breaking change).  Also `Char#digit?` is now `Char#number?` (again, the name used in unicode)\r\n\r\nThe unicode data is put at `src/unicode/data.cr` in the form of code, and that file is generated with a script. I used a format similar to how Go stores this data, which is quite interesting because it tries to store as little data as possible, so case ranges, alternate ranges and ascending strides are stored, and then looked up with a binary search.\r\n\r\nI also added `String#blank?` because it's pretty useful and it has been asked a few times before.\r\n\r\nAs a side note, there's still a lot to be done regarding unicode: normalization, grapheme clusters, etc. In particular, tests found [in this article](https://mortoray.com/2013/11/27/the-string-type-is-broken/) fail in most cases in Crystal... but they also fail in Ruby, and I'm sure in other languages too (it's a hard problem, or maybe just tedious/long to implement). Elixir [does it well](http://elixir-lang.org/getting-started/binaries-strings-and-char-lists.html). But Elixir doesn't have a Char type, only String. We'd probably need to add a `Grapheme` type or similar that would be a series of unicode codepoints that all form a single visible character. But... later. This PR is a good start towards that :-)\r\n\r\nFixes #1648 \r\nFixes #2439 \r\n","created_at":"2016-11-19T15:10:42Z","updated_at":"2016-11-19T17:36:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8dc8533f1cf24e6a772870267391b3b257fcf26b","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/crystal-lang/crystal/pulls/3560/commits","review_comments_url":"https://api.github.com/repos/crystal-lang/crystal/pulls/3560/comments","review_comment_url":"https://api.github.com/repos/crystal-lang/crystal/pulls/comments{/number}","comments_url":"https://api.github.com/repos/crystal-lang/crystal/issues/3560/comments","statuses_url":"https://api.github.com/repos/crystal-lang/crystal/statuses/1a81114bc363549fd58b9fefee0b6faba04f8dd3","head":{"label":"crystal-lang:feature/unicode","ref":"feature/unicode","sha":"1a81114bc363549fd58b9fefee0b6faba04f8dd3","user":{"login":"crystal-lang","id":6539796,"avatar_url":"https://avatars.githubusercontent.com/u/6539796?v=3","gravatar_id":"","url":"https://api.github.com/users/crystal-lang","html_url":"https://github.com/crystal-lang","followers_url":"https://api.github.com/users/crystal-lang/followers","following_url":"https://api.github.com/users/crystal-lang/following{/other_user}","gists_url":"https://api.github.com/users/crystal-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/crystal-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crystal-lang/subscriptions","organizations_url":"https://api.github.com/users/crystal-lang/orgs","repos_url":"https://api.github.com/users/crystal-lang/repos","events_url":"https://api.github.com/users/crystal-lang/events{/privacy}","received_events_url":"https://api.github.com/users/crystal-lang/received_events","type":"Organization","site_admin":false},"repo":{"id":6887813,"name":"crystal","full_name":"crystal-lang/crystal","owner":{"login":"crystal-lang","id":6539796,"avatar_url":"https://avatars.githubusercontent.com/u/6539796?v=3","gravatar_id":"","url":"https://api.github.com/users/crystal-lang","html_url":"https://github.com/crystal-lang","followers_url":"https://api.github.com/users/crystal-lang/followers","following_url":"https://api.github.com/users/crystal-lang/following{/other_user}","gists_url":"https://api.github.com/users/crystal-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/crystal-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crystal-lang/subscriptions","organizations_url":"https://api.github.com/users/crystal-lang/orgs","repos_url":"https://api.github.com/users/crystal-lang/repos","events_url":"https://api.github.com/users/crystal-lang/events{/privacy}","received_events_url":"https://api.github.com/users/crystal-lang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/crystal-lang/crystal","description":"The Crystal Programming Language","fork":false,"url":"https://api.github.com/repos/crystal-lang/crystal","forks_url":"https://api.github.com/repos/crystal-lang/crystal/forks","keys_url":"https://api.github.com/repos/crystal-lang/crystal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/crystal-lang/crystal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/crystal-lang/crystal/teams","hooks_url":"https://api.github.com/repos/crystal-lang/crystal/hooks","issue_events_url":"https://api.github.com/repos/crystal-lang/crystal/issues/events{/number}","events_url":"https://api.github.com/repos/crystal-lang/crystal/events","assignees_url":"https://api.github.com/repos/crystal-lang/crystal/assignees{/user}","branches_url":"https://api.github.com/repos/crystal-lang/crystal/branches{/branch}","tags_url":"https://api.github.com/repos/crystal-lang/crystal/tags","blobs_url":"https://api.github.com/repos/crystal-lang/crystal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/crystal-lang/crystal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/crystal-lang/crystal/git/refs{/sha}","trees_url":"https://api.github.com/repos/crystal-lang/crystal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/crystal-lang/crystal/statuses/{sha}","languages_url":"https://api.github.com/repos/crystal-lang/crystal/languages","stargazers_url":"https://api.github.com/repos/crystal-lang/crystal/stargazers","contributors_url":"https://api.github.com/repos/crystal-lang/crystal/contributors","subscribers_url":"https://api.github.com/repos/crystal-lang/crystal/subscribers","subscription_url":"https://api.github.com/repos/crystal-lang/crystal/subscription","commits_url":"https://api.github.com/repos/crystal-lang/crystal/commits{/sha}","git_commits_url":"https://api.github.com/repos/crystal-lang/crystal/git/commits{/sha}","comments_url":"https://api.github.com/repos/crystal-lang/crystal/comments{/number}","issue_comment_url":"https://api.github.com/repos/crystal-lang/crystal/issues/comments{/number}","contents_url":"https://api.github.com/repos/crystal-lang/crystal/contents/{+path}","compare_url":"https://api.github.com/repos/crystal-lang/crystal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/crystal-lang/crystal/merges","archive_url":"https://api.github.com/repos/crystal-lang/crystal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/crystal-lang/crystal/downloads","issues_url":"https://api.github.com/repos/crystal-lang/crystal/issues{/number}","pulls_url":"https://api.github.com/repos/crystal-lang/crystal/pulls{/number}","milestones_url":"https://api.github.com/repos/crystal-lang/crystal/milestones{/number}","notifications_url":"https://api.github.com/repos/crystal-lang/crystal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/crystal-lang/crystal/labels{/name}","releases_url":"https://api.github.com/repos/crystal-lang/crystal/releases{/id}","deployments_url":"https://api.github.com/repos/crystal-lang/crystal/deployments","created_at":"2012-11-27T17:32:32Z","updated_at":"2016-11-19T09:12:28Z","pushed_at":"2016-11-19T17:19:13Z","git_url":"git://github.com/crystal-lang/crystal.git","ssh_url":"git@github.com:crystal-lang/crystal.git","clone_url":"https://github.com/crystal-lang/crystal.git","svn_url":"https://github.com/crystal-lang/crystal","homepage":"http://crystal-lang.org","size":70024,"stargazers_count":6528,"watchers_count":6528,"language":"Crystal","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":542,"mirror_url":null,"open_issues_count":359,"forks":542,"open_issues":359,"watchers":6528,"default_branch":"master"}},"base":{"label":"crystal-lang:master","ref":"master","sha":"6b09c3b0f5c485ed3d179274026fbc54d1c48b21","user":{"login":"crystal-lang","id":6539796,"avatar_url":"https://avatars.githubusercontent.com/u/6539796?v=3","gravatar_id":"","url":"https://api.github.com/users/crystal-lang","html_url":"https://github.com/crystal-lang","followers_url":"https://api.github.com/users/crystal-lang/followers","following_url":"https://api.github.com/users/crystal-lang/following{/other_user}","gists_url":"https://api.github.com/users/crystal-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/crystal-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crystal-lang/subscriptions","organizations_url":"https://api.github.com/users/crystal-lang/orgs","repos_url":"https://api.github.com/users/crystal-lang/repos","events_url":"https://api.github.com/users/crystal-lang/events{/privacy}","received_events_url":"https://api.github.com/users/crystal-lang/received_events","type":"Organization","site_admin":false},"repo":{"id":6887813,"name":"crystal","full_name":"crystal-lang/crystal","owner":{"login":"crystal-lang","id":6539796,"avatar_url":"https://avatars.githubusercontent.com/u/6539796?v=3","gravatar_id":"","url":"https://api.github.com/users/crystal-lang","html_url":"https://github.com/crystal-lang","followers_url":"https://api.github.com/users/crystal-lang/followers","following_url":"https://api.github.com/users/crystal-lang/following{/other_user}","gists_url":"https://api.github.com/users/crystal-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/crystal-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crystal-lang/subscriptions","organizations_url":"https://api.github.com/users/crystal-lang/orgs","repos_url":"https://api.github.com/users/crystal-lang/repos","events_url":"https://api.github.com/users/crystal-lang/events{/privacy}","received_events_url":"https://api.github.com/users/crystal-lang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/crystal-lang/crystal","description":"The Crystal Programming Language","fork":false,"url":"https://api.github.com/repos/crystal-lang/crystal","forks_url":"https://api.github.com/repos/crystal-lang/crystal/forks","keys_url":"https://api.github.com/repos/crystal-lang/crystal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/crystal-lang/crystal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/crystal-lang/crystal/teams","hooks_url":"https://api.github.com/repos/crystal-lang/crystal/hooks","issue_events_url":"https://api.github.com/repos/crystal-lang/crystal/issues/events{/number}","events_url":"https://api.github.com/repos/crystal-lang/crystal/events","assignees_url":"https://api.github.com/repos/crystal-lang/crystal/assignees{/user}","branches_url":"https://api.github.com/repos/crystal-lang/crystal/branches{/branch}","tags_url":"https://api.github.com/repos/crystal-lang/crystal/tags","blobs_url":"https://api.github.com/repos/crystal-lang/crystal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/crystal-lang/crystal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/crystal-lang/crystal/git/refs{/sha}","trees_url":"https://api.github.com/repos/crystal-lang/crystal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/crystal-lang/crystal/statuses/{sha}","languages_url":"https://api.github.com/repos/crystal-lang/crystal/languages","stargazers_url":"https://api.github.com/repos/crystal-lang/crystal/stargazers","contributors_url":"https://api.github.com/repos/crystal-lang/crystal/contributors","subscribers_url":"https://api.github.com/repos/crystal-lang/crystal/subscribers","subscription_url":"https://api.github.com/repos/crystal-lang/crystal/subscription","commits_url":"https://api.github.com/repos/crystal-lang/crystal/commits{/sha}","git_commits_url":"https://api.github.com/repos/crystal-lang/crystal/git/commits{/sha}","comments_url":"https://api.github.com/repos/crystal-lang/crystal/comments{/number}","issue_comment_url":"https://api.github.com/repos/crystal-lang/crystal/issues/comments{/number}","contents_url":"https://api.github.com/repos/crystal-lang/crystal/contents/{+path}","compare_url":"https://api.github.com/repos/crystal-lang/crystal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/crystal-lang/crystal/merges","archive_url":"https://api.github.com/repos/crystal-lang/crystal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/crystal-lang/crystal/downloads","issues_url":"https://api.github.com/repos/crystal-lang/crystal/issues{/number}","pulls_url":"https://api.github.com/repos/crystal-lang/crystal/pulls{/number}","milestones_url":"https://api.github.com/repos/crystal-lang/crystal/milestones{/number}","notifications_url":"https://api.github.com/repos/crystal-lang/crystal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/crystal-lang/crystal/labels{/name}","releases_url":"https://api.github.com/repos/crystal-lang/crystal/releases{/id}","deployments_url":"https://api.github.com/repos/crystal-lang/crystal/deployments","created_at":"2012-11-27T17:32:32Z","updated_at":"2016-11-19T09:12:28Z","pushed_at":"2016-11-19T17:19:13Z","git_url":"git://github.com/crystal-lang/crystal.git","ssh_url":"git@github.com:crystal-lang/crystal.git","clone_url":"https://github.com/crystal-lang/crystal.git","svn_url":"https://github.com/crystal-lang/crystal","homepage":"http://crystal-lang.org","size":70024,"stargazers_count":6528,"watchers_count":6528,"language":"Crystal","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":542,"mirror_url":null,"open_issues_count":359,"forks":542,"open_issues":359,"watchers":6528,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/crystal-lang/crystal/pulls/3560"},"html":{"href":"https://github.com/crystal-lang/crystal/pull/3560"},"issue":{"href":"https://api.github.com/repos/crystal-lang/crystal/issues/3560"},"comments":{"href":"https://api.github.com/repos/crystal-lang/crystal/issues/3560/comments"},"review_comments":{"href":"https://api.github.com/repos/crystal-lang/crystal/pulls/3560/comments"},"review_comment":{"href":"https://api.github.com/repos/crystal-lang/crystal/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/crystal-lang/crystal/pulls/3560/commits"},"statuses":{"href":"https://api.github.com/repos/crystal-lang/crystal/statuses/1a81114bc363549fd58b9fefee0b6faba04f8dd3"}}}}
{"actor":{"display_login":"drhuffman12"}}