﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
22486	Warn about invalid currency symbol in charge	Famlam	team	"The [https://wiki.openstreetmap.org/wiki/Key:charge wiki] of `charge` defines the format as `charge = <amount> <currency code>[/<unit>][/<time unit>]`. Currency code is the 3-letter, uppercase code from ISO 4217.

Despite this, there is a significant usage where either the currency is not specified, or the currency is written using the symbol (either before or after the number), as can be seen on [https://taginfo.openstreetmap.org/keys/charge#values TagInfo]

Hence, I would propose to add the following rule to the validator rules:

{{{#!rule
*[charge][charge!=0][charge!~/^[0-9]+(\.[0-9]+)? [A-Z]{3}($|\/|;)/] {
  throwWarning: tr(""{0} should be structured as <(decimal) number><space><(uppercase) three letter currency code>[/optional unit][/optional time unit]"", ""{0.key}"");
  group: tr(""Invalid numerical value"");
  assertMatch: ""node charge=€12"";
  assertMatch: ""node charge=\""0.22 $/liter\"""";
  assertMatch: ""node charge=12.22"";
  assertMatch: ""node charge=\""12 EURO\"""";
  assertMatch: ""node charge=\""12 eur\"""";
  assertMatch: ""node charge=12EUR"";
  assertMatch: ""node charge=EUR12"";
  assertNoMatch: ""node charge=0"";
  assertNoMatch: ""node charge=\""12 EUR\"""";
  assertNoMatch: ""node charge=\""12 EUR/person; 18 EUR/child\"""";
  assertNoMatch: ""node charge=\""0.223 USD/liter\"""";
  assertNoMatch: ""node charge=\""12.223 YEN/1 person/1 hour\"""";
}
}}}"	enhancement	new	normal		Core validator	tested		charge	
