Character encoding auto-detection using rchardet
Current character encoding auto-detection cant differentiate cp1251 from cp866 (if both encodings are configured).
But https://rubygems.org/gems/rchardet/ can !
I have made proof of concept patch on my Redmine 3.3.1 from debian package.
And it just works without significant performance impact.