{"action":"created","comment":{"url":"https://api.github.com/repos/JuliaLang/julia/pulls/comments/30607244","id":30607244,"diff_hunk":"@@ -134,4 +165,48 @@ base64(x...) = base64(write, x...)\n \n #############################################################################\n \n+type Base64DecodePipe <: IO\n+    io::IO\n+    # reading works in blocks of 4 characters that are decoded into 3 bytes and 2 of them cached\n+    cache::Vector{UInt8}\n+    encvec::Vector{UInt8}\n+\n+    function Base64DecodePipe(io::IO)\n+        b = new(io,[],[])\n+        finalizer(b, close)\n+        return b\n+    end\n+end\n+\n+function read(b::Base64DecodePipe, t::Type{UInt8})\n+    if length(b.cache) > 0\n+        val = shift!(b.cache)\n+    else\n+        empty!(b.encvec)\n+        while !eof(b.io) && length(b.encvec) < 4\n+            c::UInt8 = read(b.io, t)\n+            @inbounds if revb64chars[c] != sentinel\n+                push!(b.encvec, c)\n+            end\n+        end\n+        val = b64decode!(b.encvec,b.cache)\n+    end\n+    val\n+end\n+\n+function eof(b::Base64DecodePipe)\n+    return length(b.cache) == 0 && eof(b.io)\n+end\n+\n+function close(b::Base64DecodePipe)\n+end\n+\n+# Decodes a base64-encoded string\n+function base64decode(s)\n+    b = IOBuffer(s)\n+    decoded = readall(Base64DecodePipe(b))","path":"base/base64.jl","position":175,"original_position":175,"commit_id":"58956c0abf7232f102ee69b18114bf7748421996","original_commit_id":"58956c0abf7232f102ee69b18114bf7748421996","user":{"login":"ScottPJones","id":11798751,"avatar_url":"https://avatars.githubusercontent.com/u/11798751?v=3","gravatar_id":"","url":"https://api.github.com/users/ScottPJones","html_url":"https://github.com/ScottPJones","followers_url":"https://api.github.com/users/ScottPJones/followers","following_url":"https://api.github.com/users/ScottPJones/following{/other_user}","gists_url":"https://api.github.com/users/ScottPJones/gists{/gist_id}","starred_url":"https://api.github.com/users/ScottPJones/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ScottPJones/subscriptions","organizations_url":"https://api.github.com/users/ScottPJones/orgs","repos_url":"https://api.github.com/users/ScottPJones/repos","events_url":"https://api.github.com/users/ScottPJones/events{/privacy}","received_events_url":"https://api.github.com/users/ScottPJones/received_events","type":"User","site_admin":false},"body":"Yes, that's definitely wrong...  esp. since most uses of base64 encoding are to store binary data, not Unicode text...","created_at":"2015-05-19T14:51:57Z","updated_at":"2015-05-19T14:51:57Z","html_url":"https://github.com/JuliaLang/julia/pull/9157#discussion_r30607244","pull_request_url":"https://api.github.com/repos/JuliaLang/julia/pulls/9157","_links":{"self":{"href":"https://api.github.com/repos/JuliaLang/julia/pulls/comments/30607244"},"html":{"href":"https://github.com/JuliaLang/julia/pull/9157#discussion_r30607244"},"pull_request":{"href":"https://api.github.com/repos/JuliaLang/julia/pulls/9157"}}},"pull_request":{"url":"https://api.github.com/repos/JuliaLang/julia/pulls/9157","id":25068226,"html_url":"https://github.com/JuliaLang/julia/pull/9157","diff_url":"https://github.com/JuliaLang/julia/pull/9157.diff","patch_url":"https://github.com/JuliaLang/julia/pull/9157.patch","issue_url":"https://api.github.com/repos/JuliaLang/julia/issues/9157","number":9157,"state":"closed","locked":false,"title":"adds base64 decoding (fixes #5656)","user":{"login":"amartgon","id":4236790,"avatar_url":"https://avatars.githubusercontent.com/u/4236790?v=3","gravatar_id":"","url":"https://api.github.com/users/amartgon","html_url":"https://github.com/amartgon","followers_url":"https://api.github.com/users/amartgon/followers","following_url":"https://api.github.com/users/amartgon/following{/other_user}","gists_url":"https://api.github.com/users/amartgon/gists{/gist_id}","starred_url":"https://api.github.com/users/amartgon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amartgon/subscriptions","organizations_url":"https://api.github.com/users/amartgon/orgs","repos_url":"https://api.github.com/users/amartgon/repos","events_url":"https://api.github.com/users/amartgon/events{/privacy}","received_events_url":"https://api.github.com/users/amartgon/received_events","type":"User","site_admin":false},"body":"fixes #5656","created_at":"2014-11-26T08:42:09Z","updated_at":"2015-05-19T14:51:57Z","closed_at":"2014-12-31T04:12:27Z","merged_at":"2014-12-31T04:12:26Z","merge_commit_sha":"e695a71f6d7f659df1802bec14c45c912b2dfd13","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/JuliaLang/julia/pulls/9157/commits","review_comments_url":"https://api.github.com/repos/JuliaLang/julia/pulls/9157/comments","review_comment_url":"https://api.github.com/repos/JuliaLang/julia/pulls/comments{/number}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/9157/comments","statuses_url":"https://api.github.com/repos/JuliaLang/julia/statuses/58956c0abf7232f102ee69b18114bf7748421996","head":{"label":"amartgon:base64_decode_#5656","ref":"base64_decode_#5656","sha":"58956c0abf7232f102ee69b18114bf7748421996","user":{"login":"amartgon","id":4236790,"avatar_url":"https://avatars.githubusercontent.com/u/4236790?v=3","gravatar_id":"","url":"https://api.github.com/users/amartgon","html_url":"https://github.com/amartgon","followers_url":"https://api.github.com/users/amartgon/followers","following_url":"https://api.github.com/users/amartgon/following{/other_user}","gists_url":"https://api.github.com/users/amartgon/gists{/gist_id}","starred_url":"https://api.github.com/users/amartgon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amartgon/subscriptions","organizations_url":"https://api.github.com/users/amartgon/orgs","repos_url":"https://api.github.com/users/amartgon/repos","events_url":"https://api.github.com/users/amartgon/events{/privacy}","received_events_url":"https://api.github.com/users/amartgon/received_events","type":"User","site_admin":false},"repo":{"id":24816124,"name":"julia","full_name":"amartgon/julia","owner":{"login":"amartgon","id":4236790,"avatar_url":"https://avatars.githubusercontent.com/u/4236790?v=3","gravatar_id":"","url":"https://api.github.com/users/amartgon","html_url":"https://github.com/amartgon","followers_url":"https://api.github.com/users/amartgon/followers","following_url":"https://api.github.com/users/amartgon/following{/other_user}","gists_url":"https://api.github.com/users/amartgon/gists{/gist_id}","starred_url":"https://api.github.com/users/amartgon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amartgon/subscriptions","organizations_url":"https://api.github.com/users/amartgon/orgs","repos_url":"https://api.github.com/users/amartgon/repos","events_url":"https://api.github.com/users/amartgon/events{/privacy}","received_events_url":"https://api.github.com/users/amartgon/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/amartgon/julia","description":"The Julia Language: A fresh approach to technical computing.","fork":true,"url":"https://api.github.com/repos/amartgon/julia","forks_url":"https://api.github.com/repos/amartgon/julia/forks","keys_url":"https://api.github.com/repos/amartgon/julia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/amartgon/julia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/amartgon/julia/teams","hooks_url":"https://api.github.com/repos/amartgon/julia/hooks","issue_events_url":"https://api.github.com/repos/amartgon/julia/issues/events{/number}","events_url":"https://api.github.com/repos/amartgon/julia/events","assignees_url":"https://api.github.com/repos/amartgon/julia/assignees{/user}","branches_url":"https://api.github.com/repos/amartgon/julia/branches{/branch}","tags_url":"https://api.github.com/repos/amartgon/julia/tags","blobs_url":"https://api.github.com/repos/amartgon/julia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/amartgon/julia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/amartgon/julia/git/refs{/sha}","trees_url":"https://api.github.com/repos/amartgon/julia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/amartgon/julia/statuses/{sha}","languages_url":"https://api.github.com/repos/amartgon/julia/languages","stargazers_url":"https://api.github.com/repos/amartgon/julia/stargazers","contributors_url":"https://api.github.com/repos/amartgon/julia/contributors","subscribers_url":"https://api.github.com/repos/amartgon/julia/subscribers","subscription_url":"https://api.github.com/repos/amartgon/julia/subscription","commits_url":"https://api.github.com/repos/amartgon/julia/commits{/sha}","git_commits_url":"https://api.github.com/repos/amartgon/julia/git/commits{/sha}","comments_url":"https://api.github.com/repos/amartgon/julia/comments{/number}","issue_comment_url":"https://api.github.com/repos/amartgon/julia/issues/comments{/number}","contents_url":"https://api.github.com/repos/amartgon/julia/contents/{+path}","compare_url":"https://api.github.com/repos/amartgon/julia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/amartgon/julia/merges","archive_url":"https://api.github.com/repos/amartgon/julia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/amartgon/julia/downloads","issues_url":"https://api.github.com/repos/amartgon/julia/issues{/number}","pulls_url":"https://api.github.com/repos/amartgon/julia/pulls{/number}","milestones_url":"https://api.github.com/repos/amartgon/julia/milestones{/number}","notifications_url":"https://api.github.com/repos/amartgon/julia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/amartgon/julia/labels{/name}","releases_url":"https://api.github.com/repos/amartgon/julia/releases{/id}","created_at":"2014-10-05T13:19:19Z","updated_at":"2015-03-14T22:49:39Z","pushed_at":"2015-04-14T11:40:59Z","git_url":"git://github.com/amartgon/julia.git","ssh_url":"git@github.com:amartgon/julia.git","clone_url":"https://github.com/amartgon/julia.git","svn_url":"https://github.com/amartgon/julia","homepage":"http://julialang.org/","size":63562,"stargazers_count":0,"watchers_count":0,"language":"Julia","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"JuliaLang:master","ref":"master","sha":"8cea71e92ae765872c86c4c5caf1784d12f2eda6","user":{"login":"JuliaLang","id":743164,"avatar_url":"https://avatars.githubusercontent.com/u/743164?v=3","gravatar_id":"","url":"https://api.github.com/users/JuliaLang","html_url":"https://github.com/JuliaLang","followers_url":"https://api.github.com/users/JuliaLang/followers","following_url":"https://api.github.com/users/JuliaLang/following{/other_user}","gists_url":"https://api.github.com/users/JuliaLang/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaLang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaLang/subscriptions","organizations_url":"https://api.github.com/users/JuliaLang/orgs","repos_url":"https://api.github.com/users/JuliaLang/repos","events_url":"https://api.github.com/users/JuliaLang/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaLang/received_events","type":"Organization","site_admin":false},"repo":{"id":1644196,"name":"julia","full_name":"JuliaLang/julia","owner":{"login":"JuliaLang","id":743164,"avatar_url":"https://avatars.githubusercontent.com/u/743164?v=3","gravatar_id":"","url":"https://api.github.com/users/JuliaLang","html_url":"https://github.com/JuliaLang","followers_url":"https://api.github.com/users/JuliaLang/followers","following_url":"https://api.github.com/users/JuliaLang/following{/other_user}","gists_url":"https://api.github.com/users/JuliaLang/gists{/gist_id}","starred_url":"https://api.github.com/users/JuliaLang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JuliaLang/subscriptions","organizations_url":"https://api.github.com/users/JuliaLang/orgs","repos_url":"https://api.github.com/users/JuliaLang/repos","events_url":"https://api.github.com/users/JuliaLang/events{/privacy}","received_events_url":"https://api.github.com/users/JuliaLang/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/JuliaLang/julia","description":"The Julia Language: A fresh approach to technical computing.","fork":false,"url":"https://api.github.com/repos/JuliaLang/julia","forks_url":"https://api.github.com/repos/JuliaLang/julia/forks","keys_url":"https://api.github.com/repos/JuliaLang/julia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JuliaLang/julia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JuliaLang/julia/teams","hooks_url":"https://api.github.com/repos/JuliaLang/julia/hooks","issue_events_url":"https://api.github.com/repos/JuliaLang/julia/issues/events{/number}","events_url":"https://api.github.com/repos/JuliaLang/julia/events","assignees_url":"https://api.github.com/repos/JuliaLang/julia/assignees{/user}","branches_url":"https://api.github.com/repos/JuliaLang/julia/branches{/branch}","tags_url":"https://api.github.com/repos/JuliaLang/julia/tags","blobs_url":"https://api.github.com/repos/JuliaLang/julia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JuliaLang/julia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JuliaLang/julia/git/refs{/sha}","trees_url":"https://api.github.com/repos/JuliaLang/julia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JuliaLang/julia/statuses/{sha}","languages_url":"https://api.github.com/repos/JuliaLang/julia/languages","stargazers_url":"https://api.github.com/repos/JuliaLang/julia/stargazers","contributors_url":"https://api.github.com/repos/JuliaLang/julia/contributors","subscribers_url":"https://api.github.com/repos/JuliaLang/julia/subscribers","subscription_url":"https://api.github.com/repos/JuliaLang/julia/subscription","commits_url":"https://api.github.com/repos/JuliaLang/julia/commits{/sha}","git_commits_url":"https://api.github.com/repos/JuliaLang/julia/git/commits{/sha}","comments_url":"https://api.github.com/repos/JuliaLang/julia/comments{/number}","issue_comment_url":"https://api.github.com/repos/JuliaLang/julia/issues/comments{/number}","contents_url":"https://api.github.com/repos/JuliaLang/julia/contents/{+path}","compare_url":"https://api.github.com/repos/JuliaLang/julia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JuliaLang/julia/merges","archive_url":"https://api.github.com/repos/JuliaLang/julia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JuliaLang/julia/downloads","issues_url":"https://api.github.com/repos/JuliaLang/julia/issues{/number}","pulls_url":"https://api.github.com/repos/JuliaLang/julia/pulls{/number}","milestones_url":"https://api.github.com/repos/JuliaLang/julia/milestones{/number}","notifications_url":"https://api.github.com/repos/JuliaLang/julia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JuliaLang/julia/labels{/name}","releases_url":"https://api.github.com/repos/JuliaLang/julia/releases{/id}","created_at":"2011-04-21T07:01:50Z","updated_at":"2015-05-19T12:57:04Z","pushed_at":"2015-05-19T14:18:35Z","git_url":"git://github.com/JuliaLang/julia.git","ssh_url":"git@github.com:JuliaLang/julia.git","clone_url":"https://github.com/JuliaLang/julia.git","svn_url":"https://github.com/JuliaLang/julia","homepage":"http://julialang.org/","size":208930,"stargazers_count":5538,"watchers_count":5538,"language":"Julia","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1160,"mirror_url":null,"open_issues_count":1306,"forks":1160,"open_issues":1306,"watchers":5538,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/JuliaLang/julia/pulls/9157"},"html":{"href":"https://github.com/JuliaLang/julia/pull/9157"},"issue":{"href":"https://api.github.com/repos/JuliaLang/julia/issues/9157"},"comments":{"href":"https://api.github.com/repos/JuliaLang/julia/issues/9157/comments"},"review_comments":{"href":"https://api.github.com/repos/JuliaLang/julia/pulls/9157/comments"},"review_comment":{"href":"https://api.github.com/repos/JuliaLang/julia/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/JuliaLang/julia/pulls/9157/commits"},"statuses":{"href":"https://api.github.com/repos/JuliaLang/julia/statuses/58956c0abf7232f102ee69b18114bf7748421996"}}}}