Fixed code and tests for bad utf-8.
Correct comment.