Replace std::to_string with locale-independent alternative
Summary:
std::to_string relies on the current locale for formatting purposes
This is a backport of Core PR18134 and PR17851
Test Plan: ninja all check-all
Reviewers: #bitcoin_abc, Fabien, majcosta
Reviewed By: #bitcoin_abc, Fabien, majcosta
Subscribers: majcosta, Fabien
Differential Revision: https://reviews.bitcoinabc.org/D8878