Fix some bugs with charset encoding on import

Currently, we fail to detect XML parse instructions (because we're not rewinding the stream) and the logic with overrides from translators was a bit incorrect.