[OSM-dev] [API] What characters to escape in tag keys/values?

Andy Allan gravitystorm at gmail.com
Fri Dec 30 14:41:33 GMT 2011

On 30 December 2011 13:47, Chris Browet <cbro at semperpax.com> wrote:
> Hi All, long time no see.
> I have an issue with a tag value ending with a "%" (percent), e.g. "15%",
> returning a 500 error from the api, while "15%20" does not.
> I assume there is some escaping logic behind but it is not clear to me which
> characters should be escaped and how.
> AFAIK, no escaping should be necessary in a xml attribute coded in UTF8, but
> I might be wrong.
> Could someone enlight me, please.

There is some escaping necessary, but not for percentage symbols. See
http://www.w3.org/TR/xml/#syntax for the definition and also
http://stackoverflow.com/a/1091953/105451 which is slightly easier to
read. Of course, there are also a handful of unicode characters that
are not valid in XML (and hence not valid in OSM) but again, that's
not what you're asking.

Sorry not to be able to help directly! Maybe if you can provide a
payload that the devs can replay against a local copy of the rails
port, that would help. And feel free to experiment against


More information about the dev mailing list