#!/usr/bin/perl -spi our($s); s/\n\r|\r\n|\n|\r/\n/g; ## normalize \n s/^(\xFF\xFE|\xFE\xFF|\xEF\xBB\xBF)//; ## remove BOM ! s/(?<=.)\z/\n/; ## ensure newline at eof if($s){ s/\xC2\xA0/ /g } ## -s non-breaking spaces-> " "