I wrote a program that automates the process of getting lyrics for the selected iTunes song.
The problem is, the final lyrics look like this:
Which I recognize is an encoding problem. In order to get the lyrics off of the website, I download the entire webpage source, extract everything between a startTag and endTag and then strip all the HTML using this code:
set plaintextLyrics to my (removeMarkup from strippedLyrics) to removeMarkup from someText -- strip HTML using textutil set someText to quoted form of ("<!DOCTYPE HTML PUBLIC>" & someText) -- fake a HTML document header return (do shell script "echo " & someText & " | /usr/bin/textutil -stdin -convert txt -stdout") -- strip HTML end removeMarkup
I have seen discussions of how to change encodings for files that are written to disc, but nothing on what to do on a string within AppleScript.
Is there a way to find/replace or otherwise fix the offending apostrophe and any other characters that are messed up?