How to convert a Textwrangler files from UTF to “Cyrillic Windows” encoding?
All files are in one folder and although the main text is in in I receive several red inverted question marks.
I tried this:
tell application "TextWrangler"
activate
set properties of front document to {line breaks:Unix, encoding:"Cyrillic (Windows)"}
end tell
or
tell application "TextWrangler"
activate
set properties of front document to {line breaks:Unix, encoding:"Cyrillic Windows"}
end tell
and different versions but I always get this error
TextWrangler got an error: An unexpected error occurred while processing an Apple Event (MacOS Error code: -10000)
Thanks Martin I use this code is a pearl code
and it seems to work no
set inputfolder to (choose folder)
set theFiles to list folder inputfolder without invisibles
repeat with x from 1 to count of theFiles
set thefile to item x of theFiles
set inputfile to quoted form of (POSIX path of inputfolder & thefile)
--set line breaks to Unix
do shell script "perl -pi -e 's/\\r/\\n/g' " & inputfile
--set encoding to "Cyrillic (Windows)"
do shell script "textutil -convert txt -encoding windows-1251 -output " & inputfile & " " & inputfile
end repeat