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

John Eldredge john at jfeldredge.com
Thu Aug 27 16:02:47 UTC 2015


Note that Wordpad, also part of the standard Microsoft utility package, 
handles linefeed-delimited files as well as Carriage Return/Linefeed 
delimited files. I don't know why Microsoft hasn't added that capability 
into Notepad.

-- 
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 3:57:09 PM Paul Norman <penorman at mac.com> wrote:

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





More information about the dev mailing list