Search code examples
applescript

AppleScript does not display dialogs that contain Unicode characters


I use AppleScript's script editor. When I try to display \u... formatted characters in a dialog box as readable text, I don't succeed. What's the problem?

Here's what I tried:

set theTextItems to (do shell script "printf \"\\u82f9\\u679c\"")
display dialog theTextItems as text

The output of the dialog box that pops up is:

\u82f9\u679c

Solution

  • It sounds like OP is trying to parse JSON-encoded data using plain AppleScript. Don’t. Use JSON Helper app (available in AppStore) or NSJSONSerialization via the AppleScript-ObjC bridge. Those will process any character escapes for you.