Fixbug: segmentation fault when value=undef and use_attr=1.
Fixbug: set utf8 flag for result string.