Fixed the charset prescan algorithm to halt after the input exhaust; Fixed the change the encoding algorithm to reload the input buffer; Fixed the default onsubdoc handler