fix an encoding issue + avoid raising an exception in one particular case