* encoding.c: applied the patch suggested #309565 which can avoid looping in error conditions. Daniel