Date: Tue, 12 Jan 2010 09:05:55 +0100
From: Allan Odgaard <mailinglist@textmate.org>
Subject: [TxMt] Re: LaTeX bundle;       reference/citation completion bug +
       suggested fix

On 11 Jan 2010, at 09:55, Andrew Hill wrote:
 > it seems to be the character %0A

0x0A is not shown as a diamond with show invisibles.

Try instead to select the diamond in TextMate and press ??X to
convert it to hexadecimal.


Right you are!
My apologies and thanks for teaching me a new trick. I also just discovered if I open up the "Edit -> Special Characters..." menu item, I can drag and drop the character into the window there to see what it is.

Anyway, it's the 0x0D character (carriage return) — I suspect my browser or the clip-board decided to clean up the line endings of the copied/pasted text by converting CR to LF before...

So it's picking up the CR char because my .tex file has CRLF line endings, and I guess the ruby script is finding ends of lines by LF character only.
To test this, I converted the document to LF line endings and the original ruby script worked fine (as did the one with the .strip addition).
With the CRLF line endings, the .strip (or better yet a removal of just trailing CR) is required. Alternatively, can ruby deal with CRLF line endings on its own?

For completeness I tried saving my document with CR line endings, and the error message was basically a re-paste of my entire document as the filename (i.e. Ruby is not parsing the CR chars as line endings, only LFs). Though I doubt anyone really uses CR line endings...

Andrew