How can I write UTF-8 files using JavaScript for Mac Automation?

后端 未结 4 854
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-13 15:05

In short - what is the JavaScript for Mac Automation equivalent of AppleScript\'s as «class utf8» ?

I have a unicode string that I\'m t

4条回答
  •  感情败类
    2021-01-13 15:45

    JXA can't do symbol types (type and enumerator names) right, and it can't do raw four-char codes at all. Either stick to AppleScript, which is the only officially supported option that speaks Apple events right, or use the Cocoa bridge to write a NSString to file in NSUTF8StringEncoding, c.f. Patrick's solution.

提交回复
热议问题