Fix base64 encoding

Long time listener, first time caller. Per https://github.com/octokit/octokit.rb/commit/c9ac24618bc326b5ab1f46d233addc2bfefb652c#commitcomment-4152077, re-implement https://github.com/octokit/octokit.rb/commit/f105b3c.

The merge in c9ac24618bc326b5ab1f46d233addc2bfefb652c appears to break `update_content` requests to files over a certain length. 

This commit trims any trailing new lines in the encoded content ensuring it's properly parsed and the update succeeds.

Discovered while working on https://github.com/benbalter/github-forms and [tested via this fork](https://github.com/benbalter/github-forms/blob/master/Gemfile), which seem to resolve the issue fully.