fix error when joining two lines with different encodings

issue in details can be found here https://github.com/gitlabhq/gitlabhq/issues/4110