systems in mac-script-code-coding-systems if specified one cannot
encode string for `com.apple.traditional-mac-plain-text'.
coding 'utf-16)))
(setq str (or s (encode-coding-string str 'utf-16-mac)))))
((eq type 'com.apple.traditional-mac-plain-text)
+ (let ((encodables (find-coding-systems-string str))
+ (rest mac-script-code-coding-systems))
+ (unless (memq coding encodables)
+ (while (and rest (not (memq (cdar rest) encodables)))
+ (setq rest (cdr rest)))
+ (if rest
+ (setq coding (cdar rest)))))
(setq coding (coding-system-change-eol-conversion coding 'mac))
(setq str (encode-coding-string str coding)))
(t