Refactor encoding setting for Windows.