[:upper:] and [:lower:] have different meanings in different locales.

Either forcing LC_ALL=C before calling the executable, or using the whole 'abzdefg....z' is preferred.

See for example:
https://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=f2dbe03dccc95f41429d60e4221b02fc0f112cc4