Handle invalid encoding sent by server (fixes Debian bug 731931)