user137369
user137369

Reputation: 5705

Internationalization of file names in applescript

Regarding this question and this answer, this a problem I encounter often. How can I tell applescript to correctly understand the file names I’m giving it, i.e. understand all characters, not just ASCII ones.

Upvotes: 1

Views: 91

Answers (1)

Lri
Lri

Reputation: 27623

The read and write commands still default to the "primary encoding", like MacRoman or MacJapanese. You can use UTF-8 by adding as «class utf8»:

$ printf äあ>/tmp/a
$ osascript -e 'read "/tmp/a"'
äあ
$ osascript -e 'read "/tmp/a" as «class utf8»'
äあ

as Unicode text is UTF-16.

Upvotes: 2

Related Questions