[OSM-dev] Semicolon
Dave Stubbs
osm.list at randomjunk.co.uk
Tue Nov 13 13:35:23 GMT 2007
On 13/11/2007, Tom Hughes <tom at compton.nu> wrote:
> In message <20071113024656.GA6626 at lochewe.mathy.remote.org>
> Frederik Ramm <frederik at remote.org> wrote:
>
> > sorry if I'm too lazy to look it up in the source, I'm hoping that
> > someone in the know can tell me off of his head: What's the current
> > official line about semicolons in node tag values ("amenity=bank;atm")
> > - are they escaped when being inserted into the DB or aren't they? Are
> > editors supposed to disallow semicolons in node keys and node values?
>
> It is still broken (for nodes). Patches welcome.
>
Patch attached.
What it does:
- escapes all ';' with '\s'
- escapes all '=' with '\e'
- escapes all '\' with '\\'
- unescapes for requests
- works for API and Potlatch
What it doesn't do:
- fix any currently entered tags
- do anything with potlatch's old escaping method (';;;', '===')
- unescape for the planet dump C code which parses the tags
- help anything else that touches the DB directly (osmosis?)
So basically anything that doesn't use the API (either node interface,
or amf interface) will fail to properly escape or unescape the ; and
=.
The patch also fixes a bug in the amf controller's handling of
escaping text for the sql (you have to triple escape '\' passed as a
replacement string to gsub as it interprets \1 \2 etc in the string,
or just use a block)
I'm not using potlatch's old escaping method as it can be ambiguous.
ie: consider:
;tag1 -> val1;
;tag2 -> val2;
becomes ";;;tag1=val1;;;;;;;tag2=val2;;;" and you have no idea where
the tags separate.
Dave
-------------- next part --------------
A non-text attachment was scrubbed...
Name: node tag escapes.patch
Type: text/x-patch
Size: 3125 bytes
Desc: not available
URL: <http://lists.openstreetmap.org/pipermail/dev/attachments/20071113/052e5183/attachment.bin>
More information about the dev
mailing list