Skip to content

Only force_encode strings to detected encoding if confidence is above threshold.

Jo Hund requested to merge jhund/gitlab_git:issue-18-encoding-helper into master

What does this MR do?

This merge request addresses issue #18 where the inline diff in GitLab UI is broken under certain circumstances.

Are there points in the code the reviewer needs to double check?

I added a confidence check before force_encoding a string to the encoding detected by CharlockHolmes. The confidence threshold can be further tuned. I set it to a value where all tests (new and existing) pass.

I also added the GitLab logo PNG file to support testing of binary strings.

Why was this MR needed?

It addresses issue #18. We work with files in dozens of different languages in GitLab, and it is extremely important to us that inline diffs are displayed correctly in all languages.

What are the relevant issue numbers?

Issue #18

Screenshots (if relevant)

Screen_Shot_2016-04-07_at_7.52.21_PM

Merge request reports