don't use document.getText to detect encoding