paolochiodi/htmlcompressor — pull request #9 by michaelbaudino (2013-07-06 22:40:50+00:00)
Title: Change Content-Length header computation to be based on a number of bytes

... instead of a number of characters (which is not always the same, e.g. with accented characters)

The bug appeared when using Middleman (the gem middleman-minify-html uses htmlcompressor). See here : http://forum.middlemanapp.com/t/middleman-minify-html-content-length-header-error/697

Also, check this IRB session for a quick example:

2.0.0-p247 :001 > 'é'.length
=> 1
2.0.0-p247 :002 > 'é'.bytesize
=> 2