Restore ability to find locale dynamically for RHEL 7
We still need to support RHEL 7 internally, which doesn't contain the C.UTF-8 locale (https://bugzilla.redhat.com/show_bug.cgi?id=1361965).
Locale detection was removed in ec3ed178. That part needs to be restored.