fix: handle string encode/decode exception in extract()