Added support of different encodings

I'v have problems with russian text in papertrailapp.com, so I decided to create a fix. I'll be happy if you  merge it to main branch!