{py,lua}_hook_script.{py,lua}: Adds malformed URL for extra unit testing.
util.py: Normalizes codec name later to not invoke chardet early.
document.py: Reduces encoding file peek to 1MB.

Adds corrupt UTF-8 document unit test.