JOSM remote control: how to add tags with '|' using load_object?addtags=

How can I escape the ‘|’ in the “key=value” pairs for the ‘addtags’ parameter?

The following remote control command does not work: the value of the tags include ‘|

http://127.0.0.1:8111/load_object?new_layer=false&relation_members=true&objects=r1549761&addtags=gtfs%3Aroute_id%3Dde%3Amvv-muenchen%3A19-210%7C210%7CRegionalBus%3A1179_3%7Cgtfs%3Atrip_id%3Asample%3Dde%3Amvv-muenchen%3A19-210%7C210%7CRegionalBus%3A1179-1-1-H-0-We%233-320-333

with expanded %xx:

http://127.0.0.1:8111/load_object?new_layer=false&relation_members=true&objects=r1549761&addtags=gtfs:route_id=de:mvv-muenchen:19-210|210|RegionalBus:1179_3|gtfs:trip_id:sample=de:mvv-muenchen:19-210|210|RegionalBus:1179-1-1-H-0-We#3-320-333

The ‘|’ is the separator for this ‘addtags’ parameter used for adding multiple key=value pairs

I tried several things to “escape” the ‘|’, but neither worked

Doesn’t look like there is a way to escape it unfortunately. The url parameter is first split at | characters, then parsed into key=value tags via the (.*?)=(.*?) regex. There’s no way to escape | characters as far as I can tell.

https://josm.openstreetmap.de/browser/josm/trunk/src/org/openstreetmap/josm/io/remotecontrol/AddTagsDialog.java#L286

Thanks, also for pointing to the code.

What remains? Do not add those key=value pairs to the addtags parameter which include |.

So: no injection of DE-BY-MVV GTFS data into OSM route_master/route relations.

The code could(/should) be changed to allow escaping/quoting special characters. I don’t see another way around that.

Looks like there’s already an open ticket for that problem, but it hasn’t had any activity.

Thanks for the link. I’ve added a comment.

1 Like

I implemented a work-around in PTNA

There’s a fix in JOSM and PTNA

1 Like