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

John Eldredge john at jfeldredge.com
Tue Aug 25 22:20:34 UTC 2015


Also, the ftp file transfer protocol gives you the choice of binary 
transfer (files are transmitted unchanged), or text transfer (files are 
changed to a canonical format during transmission, then the receiving end 
changes line termination to the default for its operating system), so you 
may see some files that have been converted and some that haven't.

-- 
John F. Eldredge -- john at jfeldredge.com
"Darkness cannot drive out darkness; only light can do that. Hate cannot 
drive out hate; only love can do that." -- Martin Luther King, Jr.



On August 25, 2015 7:49:34 AM Andy Townsend <ajt1047 at gmail.com> wrote:

> 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
>
>
>
> _______________________________________________
> dev mailing list
> dev at openstreetmap.org
> https://lists.openstreetmap.org/listinfo/dev





More information about the dev mailing list