Turns out it's more complicated than that. I want to be able to debug the code on macs, pc's, and on the Synology, and the possible locale variable can differ depending on what system you're running it on. For example, on the Synology it's:

en_US.utf8

And on Mac, it's

en_US.UTF-8

And if you use the wrong one, everything fails. My first idea is to only change the variable if it's currently null, and if it's null, then parse the output results of the command:

locale -a

and then try to find a match that's close to one of the two above and then force it to that.
_________________________
Tony Fabris