Check for error on non-utf8 encoding (utf16 used).
Clean up comments and unused variables.
Final commit to get parity with rebased branch importutest2