Fix UnicodeDecodeError when replace interpreter in non-ascii file