[OSM-dev] Disallowing certain characters in tag keys

Ulf Lamping ulf.lamping at googlemail.com
Sun Oct 17 08:48:31 BST 2010


Am 16.10.2010 20:44, schrieb Jochen Topf:
> Hi!
>
> I am currently fighting some issues where tags with strange characters in them
> need to be represented in a URL for Taginfo. Lots of other websites probably
> will have similar issues. Characters like /, ?,&, etc. have special meaning
> in URLs so if they appear in tags I can't have those tags in URLs. Sometimes
> escaping characters as %XX helps, sometimes not. And those problems are not
> confined to web pages and URLs only. Special characters that need escaping
> are often a problem.

Yes, special characters can cause headaches. I remember this from my own 
tag analyzing experiments and other software projects ;-)

I agree with you that most (all?) of them are (usually unintended) bugs. 
For example: Not long ago, it was a common tag problem that keys started 
or ended with a space char. IIRC the xybot regularly fixes those bugs now.

However, as those characters can be used in the name values (and 
elsewhere), you have to deal with the correct handling of special 
characters in your software anyway, so I'm not sure if disallowing 
special characters in the key will really help us in that regard.

The problem with disallowing special characters is that you "close the 
door". Software writers will then write software that depends on them 
not being there (or not caring which is probably the common case today). 
If we later find out that - for whatever reasons - we want to use one of 
those chars this will become extremely difficult, as it will cause 
trouble at many places in existing software.


What we currently don't have is a guideline for mappers. I'm missing 
(and thinking to write for some time) a: "How to write good tags". To my 
knowledge we don't have a written guide (not rule) that we tend to used 
lower case chars, underscores instead of spaces and all that "unwritten 
rules". Of course, this could include: "don't use special chars like /, 
?, ... in keys - because this makes it hard for software writers".


I tend to simply ignore keys with special chars - as we do it today ...

Regards, ULFL



More information about the dev mailing list