At some level I feel it's the API's job to reject changesets with invalid key/value lengths or characters. JOSM should perhaps have a matching validator rule.