set targetFolder to choose folder with prompt "Choose the target folder"
set destinationFolder to choose folder with prompt "Choose the destination folder"
tell application "Finder"
repeat with i from 1 to count files of folder targetFolder
set aFile to file i of targetFolder
set fileName to name of aFile
set fileNameExt to name extension of aFile
set savePath to (destinationFolder as string) & fileName
if fileNameExt is "txt" then
tell application "TextWrangler"
--activate
set aFile to aFile as alias
open aFile with LF translation
zap gremlins text 1 of text document 1 zap action replace_with_code with non ASCII characters and controls
replace "\\0x2028" using "\n" searching in text 1 of text document 1 options {search mode:literal, starting at top:true, wrap around:false, backwards:false, case sensitive:false, match words:false, extend selection:false}
replace "\\0x300A" using "(" searching in text 1 of text document 1 options {search mode:literal, starting at top:true, wrap around:false, backwards:false, case sensitive:false, match words:false, extend selection:false}
replace "\\0x300B" using ")" searching in text 1 of text document 1 options {search mode:literal, starting at top:true, wrap around:false, backwards:false, case sensitive:false, match words:false, extend selection:false}
replace "\\0xFF1A" using ":" searching in text 1 of text document 1 options {search mode:literal, starting at top:true, wrap around:false, backwards:false, case sensitive:false, match words:false, extend selection:false}
replace "\\0xFFFC" using "" searching in text 1 of text document 1 options {search mode:literal, starting at top:true, wrap around:false, backwards:false, case sensitive:false, match words:false, extend selection:false}
replace "\\0x201C" using "\"" searching in text 1 of text document 1 options {search mode:literal, starting at top:true, wrap around:false, backwards:false, case sensitive:false, match words:false, extend selection:false}
replace "\\0x201D" using "\"" searching in text 1 of text document 1 options {search mode:literal, starting at top:true, wrap around:false, backwards:false, case sensitive:false, match words:false, extend selection:false}
replace "\\0x3000" using "\n" searching in text 1 of text document 1 options {search mode:literal, starting at top:true, wrap around:false, backwards:false, case sensitive:false, match words:false, extend selection:false}
replace "\\0x3002" using "" searching in text 1 of text document 1 options {search mode:literal, starting at top:true, wrap around:false, backwards:false, case sensitive:false, match words:false, extend selection:false}
replace "\\0x25A0" using "" searching in text 1 of text document 1 options {search mode:literal, starting at top:true, wrap around:false, backwards:false, case sensitive:false, match words:false, extend selection:false}
set theEncoding to text returned of (display dialog "What encoding would you like to set for file " & fileName with title "File encoding" default answer "Western (ISO Latin 9)")
set encoding of text document 1 to theEncoding
set lineBreaks to text returned of (display dialog "What line breaks would you like to set for file " & fileName & return & "Example : Mac/Unix/DOS" with title "File line breaks" default answer "Unix")
set line breaks of text document 1 to lineBreaks
save text document 1 to file savePath
close text document 1
end tell
end if
end repeat
tell application "TextWrangler" to quit
end tell