[OSM-dev] Line endings on Windows for OSM files

Andy Townsend ajt1047 at gmail.com
Tue Aug 25 12:44:02 UTC 2015


On 25/08/2015 13:00, Jochen Topf wrote:
> Hi!
>
> 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.
> Does Osmosis do it that way? Other programs? What about when I download a
> planet file or call the OSM API? Does the browser magically convert the LFs
> in those files into CRLFs? What about when the file is gzipped?
>
> Ideally I want to do whats least surprising to Windows users. Whatever is
> most convenient for them, works with the most software they have.
>
> Jochen

Hi Jochen,

Even on Windows, as a user I wouldn't be surprised by XML files with 
Unix line termination.  I've just had a dig around on my work Windows 
PC, and there's a fairly even split of the not-obviously-crossplatform 
ones.  Garmin GPX files created by MapSource (Windows) use Unix line 
termination; stuff that's Java will be cross-platform and will tend to 
create that line termination too.

One possible "surprise" might be that the default text Windows editor 
(at least on Windows 7) doesn't understand Unix line termination, but I 
can't see people manually editing .osm XML files using that.

There may of course be stuff that's come over from Unix that requires LF 
termination too (though I'd expect most things will be agnostic).

Cheers,

Andy





More information about the dev mailing list