Fix incorrectly calculating non-ascii character content length