开发者

Copying Korean characters from Excel to TextEdit with AppleScript

开发者 https://www.devze.com 2023-02-05 22:22 出处:网络
I have an Excel spreadsheet which contains Korean characters in who-knows-what encoding -- I\'m assuming it\'s UTF-8 since I can copy and paste it into vim or textedit or whatever just fine.I can then

I have an Excel spreadsheet which contains Korean characters in who-knows-what encoding -- I'm assuming it's UTF-8 since I can copy and paste it into vim or textedit or whatever just fine. I can then insert those characters into a database I know is UTF-8 and that works just fine too.

However, when I run the following AppleScript that presumably does the same thing, I get all the Korean characters replaced by the letter "a". Is 开发者_运维知识库there a way to force an encoding when copying or pasting with AppleScript? Am I missing something else?

Example cell in Korean: 이메일 주소.

Same output in TextEdit: aaa aa

tell application "Microsoft Excel"
       activate
       open (choose file)
       activate object sheet "Sheet1"
       copy range range "A1:G1000" of active sheet
end tell

tell application "TextEdit"
       activate
       open (choose file)
       tell application "System Events"
               keystroke (the clipboard)
       end tell
end tell


Since you are copying and pasting, why not just do that. You copy in excel so in TextEdit just use this...

tell application "System Events"
    keystroke "v" using command down
end tell
0

精彩评论

暂无评论...
验证码 换一张
取 消