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

Andreas Labres list at lab.at
Wed Aug 26 14:37:04 UTC 2015


On 25.08.15 14:00, 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.
> 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?

\r\n would be the standard Windows line endings for text (and XML?) files. But
most text etc. editors can handle both "Windows" (CRLF) and "Unix" (LF) line
endings.

As OSM files received via the API have Unix line endings and as JOSM uses (at
least by default) Unix line endings - so it's always \n only - I think it would
be kind of strange if the default wouldn't also be Unix line endings for your lib.

Browsers don't change line endings (if you save an OSM file received via the
API, you get \n only). Only FTP programs convert if text (not binary!) transfer
mode is used.

/al



More information about the dev mailing list