fix fd leak

add: setcharset