refactor file saving, use windows-1252 encoding