Move encoding methods to the more general EncodingHelper Closes gitaly#847 See merge request gitlab-org/gitlab-ce!16137