replace invalid utf8 with ?
support non-utf-8 byes and reserve_data
cleanup some code for readability
add option to specify to replace invalid chars (default: not to replace chars)