On 8/25/2015 5:00 AM, Jochen Topf wrote:
I am working on the libosmium C++ library. It can read and write all sorts of
OSM files. And it works on Windows. No I have been asking myself whether I am
using the "right" line endings on Windows. Unix normally has LF, Windows has
CRLF. So does that mean I should write OSM XML files with CRLF on Windows.
For reading OSM XML, there are two cases: programs which parse it, and hand-reading/editing. In the former case, it doesn't matter, as it's all non-significant whitespace.

When reading XML as text, a decent text editor can handle both types of line endings. Notepad isn't a decent text editor, so it assumes Windows line endings, but editing large XML file in Notepad is a horrible idea for other reasons.

Does Osmosis do it that way? Other programs? What about when I download a
planet file or call the OSM API?
JOSM on Windows saves with windows line endings. Planet files and the OSM API are generated on Linux, so use Unix line endings.
Does the browser magically convert the LFs in those files into CRLFs?
Browsers will display the file as XML, not as text, so it doesn't matter here.
What about when the file is gzipped?
It's probably going to be parsed, so it doesn't matter here.

I think it makes the most sense to keep behavior consistent between Osmium on Unix and on Windows, unless relying on XML library defaults, in which case, you don't need to care.

_______________________________________________
dev mailing list
[email protected]
https://lists.openstreetmap.org/listinfo/dev

Reply via email to