I have an old app that can only correctly read Windows text files.
Is there a way in Applescript to convert a text file from Western (Mac OS Roman) encoding and Classic (CR) line breaks to Western (Windows Latin 1) encoding with Windows (CRLF) line breaks without resorting to a third party solution? I’ve seen some scripts online that address converting the line breaks but none that handle the characters as well to make sure diacriticals don’t get messed up.
Hard question. MacOS Roman is hardly used nowadays. I’ve read that it has no BOM so you can just convert the Returns to Linefeeds for utf8. Then you can use unix ‘textutil’ to convert from utf8 to Word document. I’m not sure if you might lose some characters, but thinking that you might.
is a command line utility, that you can read about by entering man iconv in a terminal window. Getting this to work as you’d expect is the hard part of your conversion.
There are litterally a zillion ways to convert returns to linefeed. For instance the tr command, with something like tr ‘\r’ ‘\n’ added to the end of command line of iconv.