Ascii vs. Utf-8 when Running Shell Scripts in Automator...?
I am trying to run ocrmypdf (a command-line implementation of Tesseract) in Automator (currently as a workflow, and once debugged, as an app). I can run ocrmypdf in termal, but in Automator, I get an error stating:
"RuntimeError: ocrmypdf will abort further execution because Python 3 was configured to use ASCII as encoding for the environment."
I have adapted instructions from another shell script. The ocrmypdf version reads:
for f in "$@"
do
suffix="-eng-ocred.pdf"
base=`basename "$f" .pdf`
outputfile=$base$suffix
/usr/local/bin/ocrmypdf --force-ocr "$f" "$outputfile"
done
Some online sources suggest using environment variables LC_ALL and LANG; in this case both would be en_US.UTF-8 but I couldn't get these to work, and other sources state these are specific to Linux proper and don't work in MacOS.
Any idea how to avoid this bug in automator?
If I can get this fixed, I will probably set up different apps for different languages. I don't know how to query myself for the appropriate language.
MacBook Air (11-inch Mid 2013), macOS Sierra (10.12.6)