Added withEncoding method

Added withEncoding method which didn't solve my problem but I think might be useful :)