I've posted a new attempt at ripping those ECPG setlocales() out onthe other thread that had the earlier version and discussion:
https://www.postgresql.org/message-id/CA%2BhUKG%2BYv%2Bps%3DnS2T8SS1UDU%3DiySHSr4sGHYiYGkPTpZx6Ooww%40mail.gmail.com