[OSM-dev] Disallowing certain characters in tag keys

Jochen Topf jochen at remote.org
Tue Oct 19 10:25:38 BST 2010

On Tue, Oct 19, 2010 at 10:06:15AM +0100, Tom Hughes wrote:
> On 16/10/10 19:44, Jochen Topf wrote:
>> 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.
> I really don't understand the problem here - as far as I know all  
> characters can be used in URLs so long as they are properly escaped. If  
> your server software is not coping with that for some reason then I  
> think it's a bug.

That might well be a bug. But those bugs creep up all the time, because these
things are hard to do and because the specs are not as clear as they should be.
I am not saying these things can't be done right, but wouldn't it be nice if
we can get rid of that problem instead of everybody writing software for OSM
having to make sure all those cases are handled properly?

> As a test I just created a file called '<>&+?#;%.html' in an apache  
> served directory and then asked Firefox to fetch:
>   http://server/%3c%3e%26%2b%3f%23%3b%25.html
> and it was retrieved just fine.

And now try the same thing again creating a filename with a '/' in it and see
whether it works this time. It doesn't, because '/' is special for Unix (and
HTTP) and you need to create a directory with the first part of your name and
then the second as file. If you would actually want to create one file for
every key in the OSM database in your filesystem, you'd have a problem.

You example basically proves my point. :-)

Jochen Topf  jochen at remote.org  http://www.remote.org/jochen/  +49-721-388298

More information about the dev mailing list