Imap input filter - connection refused

It tried this:

codec => plain {
	charset => "Windows-1255"
}

I got this charset from email header.
Logstash is crashing with this error:

 Error: undefined method `encode' for nil:NilClass {:level=>:error}←[0m