Fixbug: segmentation fault.
Fixbug: skip test if encoding is not supported.