Add encoding support

Adds libiconv support so that other encodings besides utf8 can be
used.