Use locale independent ToString(…) instead of locale dependent strprintf(…) for low-level string formatting.
Context: See sipas comment in #18147 (comment).
Example taken from #18281:
Low level functions
ScriptToAsmStr(core_io),i64tostr(strencodings) anditostr(strencodings) are locale dependent:0const std::vector<uint8_t> b{0x6a, 0x4, 0xff, 0xff, 0xff, 0xff}; 1const CScript script{b.begin(), b.end()}; 2for (const std::string& locale_string : {"C", "de_DE"}) { 3 std::locale::global(std::locale(locale_string)); 4 std::cout << "[" << locale_string << "] ScriptToAsmStr(script, false) == " 5 << ScriptToAsmStr(script, false) << "\n"; 6}0[C] ScriptToAsmStr(script, false) == OP_RETURN -2147483647 1[de_DE] ScriptToAsmStr(script, false) == OP_RETURN -2.147.483.647
Fixes #18281.