I am trying to merge together two .osm XML files using Osmosis from CLI. In the XML files there is some public transport data (like bus stops) and some of them have an apostrophe (') in their name (as in Italy is often considered as an accent). When I try to merge the two files, I get a single XML file but with the apostrophes being replaced with the ' string.

How can I preserve the apostrophes after the merge?

1 Answer 1


You can't with osmosis. In XML, ' is the entity for a single quote, and any XML library should treat them the same. If they are not being treated the same, this is a bug in the library you are using.

You could post-process the file with xmllint, which will by default change the entity to a ' in double-quotes if possible. xmllint is part of libxml2-utils on Debian-based systems.

This will not guarantee all ' are represented as ' instead of ', because if a string contains both a single and double quote, at least one of them must be represented as an XML entity.

  • Oh alright, it was mostly in case I needed to check manually the files so I could understand immediately what the special character was. Thanks!
    – Gabboxl
    Feb 22 at 13:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.