Text Encoding in Datei ändern
16/04/2010 Ich brauchte auf die Schnelle ein Skript, mit dem sich eine cvs-Datei die von einem Windows-PC stammt (ISO-8859-1) von der Zeichenkodierung so umstricken lässt, dass ein Mac auf Anhieb (meist UTF-8 oder UTF-16) auch die ganzen Sonderzeichen (öüÖ usw.) korrekt darstellt.
Dieses AppleScript Droplet konvertiert mit iconv die Datei also nach UTF-16 und speicher sie im selben Verzeichnis mit vorrangestelltem _ ab.
No CommentsDieses AppleScript Droplet konvertiert mit iconv die Datei also nach UTF-16 und speicher sie im selben Verzeichnis mit vorrangestelltem _ ab.
Code zum markieren einmal anklicken Code im Skript-Editor öffnen
on open these
tell application "Finder"
if (count of these) is 1 then
repeat with this in these
if name of this ends with ".csv" then
set this_x to POSIX path of this
set this_name to name of this
set this_folder_X to POSIX path of ((container of this) as alias)
do shell script "cd " & quoted form of this_folder_X & ";iconv -f ISO-8859-1 -t UTF-16 " & quoted form of this_x & ">_" & quoted form of (this_name) as text
end if
end repeat
end if
end tell
end open