Render partial generate unwanted spaces

Confirmation of my second guess:

It's Komodo Editor, adding ugly stuff. I've open and added some files in the projects using Radrails and everything is okay. Though i have no way to correct files corrupted by Komodo (open and save doesn't do the trick). Damn Komodo!!! And maybe some other text-editors generate the same kind of horror.

if it’s the adding of cr/lf, try scite - it has the ability to specify and convert eol to and from cr, cr/lf, or lf. A bit of a pain to do manually, but I dn’t know how to do automatically.

Julien wrote in post #966616:

I tried Scite and converted some CR/LF endings to LF only but it doesn't correct the issue. My gut tells me it's not an matter of line endings since the strange digit appears at the very beggining of the inclusion of the partial (or the yield). I don't know much about file system but i suppose Komodo was created on Linux and uses some file headers which are not correctly understood by Webrick on Windows which then tries to print them.

I don't have that many partials and will simply recreate them and copy/ paste the code using radrails. I should have guessed that the editor was to blame before, because i finished a previous full project on Radrails and never encountered that problem. I switched because Radrails is a slow when you ctrl+s.

Well i guess the conclusion of all this is that if you encounter unwanted spaces in your partials, check your editor :slight_smile:

It would be interesting to inspect the file with a hex editor to see exactly what the non-printing chars are. They are not tabs are they?

Colin

Julien wrote in post #966777: [...]

My gut tells me it's not an matter of line endings since the strange digit appears at the very beggining of the inclusion of the partial (or the yield). I don't know much about file system but i suppose Komodo was created on Linux and uses some file headers which are not correctly understood by Webrick on Windows which then tries to print them.

Since you don't know much about the filesystem, perhaps you shouldn't be making silly speculations. Komodo does no such thing AFAIK.

What *might* be going on is that your file is being saved as UTF-8 with a byte order mark (BOM) at the beginning. That shouldn't cause problems, but try changing the encoding to UTF-8 without BOM and see what happens.

Best,

Jumping the gun I know, but if it were the BOM then would that be a bug in rails as a BOM at the start of a partial should not be sent out to the browser, should it?

Colin

Colin Law wrote in post #966863:

making silly speculations. Komodo does no such thing AFAIK.

What *might* be going on is that your file is being saved as UTF-8 with a byte order mark (BOM) at the beginning. That shouldn't cause problems, but try changing the encoding to UTF-8 without BOM and see what happens.

Jumping the gun I know, but if it were the BOM then would that be a bug in rails as a BOM at the start of a partial should not be sent out to the browser, should it?

It actually shouldn't matter. The BOM was chosen rather cleverly: it's U+FEFF ZERO-WIDTH NONBREAKING SPACE, so it should have no typographical effect whatsoever. But maybe the browser is detecting it as whitespace, or maybe there's a further encoding issue. Or maybe something else is going on.

Colin

Best,

I'm not sure it's the editor; my own issues are coming with Notepad+ +. Still, I'm glad I checked back into this thread. It's given me some stuff to try out. If I find the magic solution (or if I don't) I'll check back in.

Okay, here's what I've got so far:

If I encode in ANSI or UTF-8 without BOM, I lose my phantom spaces.

If I encode in plain old UTF-8, phantom spaces with my partials.

Dunno why...but at least I can use partials again without mucking up my page.

One small step for man, I know....

bravehoptoad wrote in post #966994:

Okay, here's what I've got so far:

If I encode in ANSI or UTF-8 without BOM, I lose my phantom spaces.

If I encode in plain old UTF-8, phantom spaces with my partials.

Dunno why...

You've got your answer, I guess. It *is* the BOM creating problems, or so it would seem from the behavior above.

Just checking: UTF-8 without BOM: no problems UTF-8 with BOM: problems Right?

If so, then we have isolated the problem to a minimal pair.

but at least I can use partials again without mucking up my page.

One small step for man, I know....

I've never seen this problem on *nix. I wonder if it's an artifact of Windows' text handling routines.

Best,

Just checking: UTF-8 without BOM: no problems UTF-8 with BOM: problems Right?

Correct.

I've never seen this problem on *nix. I wonder if it's an artifact of Windows' text handling routines.

Yes, I strongly suspect, since the two people who've had this problem are working on Windows with different text editors.

This was a great thread. I never would have looked at the encoding without you guys.

Hey you rock people, UTF8 without BOM is perfect. Sorry for silly speculations on Komodo :slight_smile: Glad we found the root of it. Thank you all!