2012-08-04 98 views
0

我有这个AppleScript,它返回iTunes中当前正在播放的艺术家的名字。不幸的是,如果艺术家名字包含特殊字符,比如ú,则会输出奇怪的字符。我怎样才能解决这个问题?AppleScript输出中的奇怪字符

tell application "iTunes" 
    if player state is playing then 
     try 
      set myTrack to artist of current track 
     on error 
      return "" 
     end try 
     return myTrack 
    end if 
end tell 

回答

0

Unicode字符通常不应造成任何问题:

tell application "iTunes" to tell current track 
    set name to "あ" 
    name -- あ 
end tell 

的某些文件的ID3标签可能有一些非Unicode编码。我不知道如何处理来自AppleScript的内容,但是您可以尝试将标记转换为UTF-8吗?见https://superuser.com/questions/90449/repair-encoding-of-id3-tagshttp://code.google.com/p/id3-to-unicode/

+0

是不是UTF-8苹果的默认?即使我在iTunes的ID3字段框中直接从键盘输入ú,问题仍然存在。 – Zade 2012-08-07 00:38:57