applied the patch suggested #309565 which can avoid looping in error

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