Created
March 26, 2011 03:43
-
-
Save netj/888003 to your computer and use it in GitHub Desktop.
AppleScript that sets text encoding (xattr) of currently selected files in Finder (to UTF-8)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/osascript | |
# AppleScript that sets text encoding (xattr) of currently selected files in Finder (to UTF-8) | |
# Author: Jaeho Shin <[email protected]> | |
# Created: 2011-03-25 | |
# See-Also: http://vim.1045645.n5.nabble.com/MacVim-file-encoding-and-Quicklook-td1216113.html | |
# See-Also: http://xahlee.org/comp/OS_X_extended_attributes_xattr.html | |
tell application "Finder" | |
set names to "" | |
repeat with f in (selection as alias list) | |
set names to names & " " & (quoted form of (POSIX path of (f as alias))) | |
end repeat | |
if names is not equal to "" then | |
# TODO maybe one might want to pick an encoding? | |
do shell script "xattr -w com.apple.TextEncoding 'UTF-8;134217984' " & names | |
end if | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment