Fix encoding of special characters

See bug https://forge.kayako.com/issues/229