I’ve got a simple shell script which synchronizes Google Calendars for quick local access. When I run it from the command line, events with non-ASCII characters (like ä, ö, å) work fine, and the generated output file looks perfect.
However, when the script gets run from cron, the characters are mangled in the output files. For instance, Ä is replaced with the literal character sequence \xc4 (ie, “Ärstidernas” becomes “\xc4rstidernas”). The script is being run on OSX 10.6. I’ve no idea which tool in the chain (cron, bash, python-2.6) is causing this to happen. What could be wrong?
Thanks to @aztaroth, I did a bit of research on
LC_CTYPEand found that the correct solution is to add this to the script:LC_CTYPEexpects a character encoding type, not a language charset. So setting it to UTF-8 fixed the problem.