search: handle incompatible encoding error

It may be occurred when inspecting object to generate error message.