mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-19 18:45:52 +00:00
In JSON, output unprintable currency codes as hex
This commit is contained in:
@@ -223,6 +223,14 @@ std::string STAmount::createHumanCurrency (const uint160& uCurrency)
|
||||
{
|
||||
static uint160 const sIsoBits ("FFFFFFFFFFFFFFFFFFFFFFFF000000FFFFFFFFFF");
|
||||
|
||||
// Characters we are willing to include the ASCII representation
|
||||
// of a three-letter currency code
|
||||
static std::string legalASCIICurrencyCharacters =
|
||||
"abcdefghijklmnopqrstuvwxyz"
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
"0123456789"
|
||||
"<>(){}[]|?!@#$%^&*";
|
||||
|
||||
if (uCurrency.isZero ())
|
||||
{
|
||||
return SYSTEM_CURRENCY_CODE;
|
||||
@@ -244,7 +252,8 @@ std::string STAmount::createHumanCurrency (const uint160& uCurrency)
|
||||
|
||||
// Specifying the system currency code using ISO-style representation
|
||||
// is not allowed.
|
||||
if (iso != SYSTEM_CURRENCY_CODE)
|
||||
if ((iso != SYSTEM_CURRENCY_CODE) &&
|
||||
(iso.find_first_not_of (legalASCIICurrencyCharacters) == std::string::npos))
|
||||
return iso;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user