{"action":"created","issue":{"url":"https://api.github.com/repos/SCPR/SCPRv4/issues/303","labels_url":"https://api.github.com/repos/SCPR/SCPRv4/issues/303/labels{/name}","comments_url":"https://api.github.com/repos/SCPR/SCPRv4/issues/303/comments","events_url":"https://api.github.com/repos/SCPR/SCPRv4/issues/303/events","html_url":"https://github.com/SCPR/SCPRv4/pull/303","id":90800844,"number":303,"title":"Add form hash filter to force the encoding of binary form strings to UTF-8","user":{"login":"Ravenstine","id":5193330,"avatar_url":"https://avatars.githubusercontent.com/u/5193330?v=3","gravatar_id":"","url":"https://api.github.com/users/Ravenstine","html_url":"https://github.com/Ravenstine","followers_url":"https://api.github.com/users/Ravenstine/followers","following_url":"https://api.github.com/users/Ravenstine/following{/other_user}","gists_url":"https://api.github.com/users/Ravenstine/gists{/gist_id}","starred_url":"https://api.github.com/users/Ravenstine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ravenstine/subscriptions","organizations_url":"https://api.github.com/users/Ravenstine/orgs","repos_url":"https://api.github.com/users/Ravenstine/repos","events_url":"https://api.github.com/users/Ravenstine/events{/privacy}","received_events_url":"https://api.github.com/users/Ravenstine/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-06-24T23:00:42Z","updated_at":"2015-06-30T21:10:15Z","closed_at":"2015-06-30T21:10:15Z","pull_request":{"url":"https://api.github.com/repos/SCPR/SCPRv4/pulls/303","html_url":"https://github.com/SCPR/SCPRv4/pull/303","diff_url":"https://github.com/SCPR/SCPRv4/pull/303.diff","patch_url":"https://github.com/SCPR/SCPRv4/pull/303.patch"},"body":"@ewr @sdillingham \r\n\r\nI have now changed the implementation to be included in the same place that the file name sanitization happens.  A middleware traverses the Rack form hash and calls #force_encoding on every string so that binary strings are now interpreted as UTF-8.  If for some reason force_encoding fails, it will just return the original string untouched.  \r\n\r\nSo far, I think this is the best approach because since binary files uploaded through the form have already been saved to tempfiles and referenced by File objects, they'd be ignored by my code since they are not strings.  If we are already having our files uploaded in that fashion, I can't think of any reason why we would ever need binary to come through in our form input.  \r\n\r\nCombining this with our file name sanitization hopefully means that we wouldn't have as many encoding problems."},"comment":{"url":"https://api.github.com/repos/SCPR/SCPRv4/issues/comments/117342613","html_url":"https://github.com/SCPR/SCPRv4/pull/303#issuecomment-117342613","issue_url":"https://api.github.com/repos/SCPR/SCPRv4/issues/303","id":117342613,"user":{"login":"Ravenstine","id":5193330,"avatar_url":"https://avatars.githubusercontent.com/u/5193330?v=3","gravatar_id":"","url":"https://api.github.com/users/Ravenstine","html_url":"https://github.com/Ravenstine","followers_url":"https://api.github.com/users/Ravenstine/followers","following_url":"https://api.github.com/users/Ravenstine/following{/other_user}","gists_url":"https://api.github.com/users/Ravenstine/gists{/gist_id}","starred_url":"https://api.github.com/users/Ravenstine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ravenstine/subscriptions","organizations_url":"https://api.github.com/users/Ravenstine/orgs","repos_url":"https://api.github.com/users/Ravenstine/repos","events_url":"https://api.github.com/users/Ravenstine/events{/privacy}","received_events_url":"https://api.github.com/users/Ravenstine/received_events","type":"User","site_admin":false},"created_at":"2015-06-30T21:10:15Z","updated_at":"2015-06-30T21:10:15Z","body":"Actually, I'll close this since our solution has already been merged.  If that ends up being problematic, this can be re-created."}}