Line-endings with Mac + Linux + Windows
Mads Kiilerich
mads at kiilerich.com
Mon Mar 2 17:04:42 CST 2009
Jeremy Lizakowski wrote, On 03/02/2009 11:45 PM:
> I'm running into text files that have ^M (ctrl-m) characters at the end
> of every line. This likely occurred during many edits amongst Mac,
> Linux, and Windows. I think Mac is the main issue.
>
These days Mac is mostly just like Unix. So unless your editor is very
broken I don't think so.
> I'm also seeing a single <FEFF> character at the start of a file, which
> is unicode for a non-breaking space IIRC.
>
http://en.wikipedia.org/wiki/Byte_order_mark - often inserted by Windows
editors.
> I tried using win32text to try maintain text files in unix format. But
> when I did update null and update, it gave a lot of warnings about
> 'already has CRLF line endings', and didn't convert the ^M characters.
>
That is because win32text assumes that the files in the repository has
unix linefeeds and replaces them with windows linefeeds on checkout.
When the files already has windows linefeeds it is smart enough to warn
that it is confused.
The simplest solution is to disable win32text (or do this on Unix where
it usually isn't enabled at all), convert all files to unix linefeeds
(for example with dos2unix), and commit them.
> What's the best way to fix/work with line endings?
>
The best way is to assume that Mercurial doesn't change files and make
sure that you handle the encoding "correctly" (whatever that means to
you) on all platforms.
/Mads
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3435 bytes
Desc: S/MIME Cryptographic Signature
Url : http://selenic.com/pipermail/mercurial/attachments/20090303/7c639d0d/attachment.bin
More information about the Mercurial
mailing list