Convert encoding using ICU instead of iconv and add an encoding detector

Pending: MSVC support, then fixes #68.