Special character returned by AppleScript when task name contains ' (apostrophe)

I am trying set a variable to the name of a task, and then write that variable to a markdown file.
The title of the task is “Tom’s payment due”.

Based on what I researched on the Internet, and based on looking at it on the sreen, it appears that since the apostrophe is a “curly apostrophe”, my markdown application is not able to read it. Even cat on the command line seems to print � instead of the curly '.

This is how I am setting the taskName variable.

set taskName to name of theCurrentTask

Any suggestions as to what I can do to write the file such that these apostrophe’s are handled properly? Ideally the curly ’ becomes straight '. And even more ideally, would like to handle even other non text characters so that the task name can be written to a markdown file.

Thank you.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.