Project

General

Profile

Actions

Feature #8699

closed

Feature request: Detect line encoding problems

Added by mattsains (Matthew Sainsbury) almost 12 years ago. Updated almost 12 years ago.

Status:
Closed
Target version:
-
[ruby-core:56240]

Description

This is a feature which would have saved me hours of debugging.

If you give ruby a file with old mac line endings, ruby does not recognise them as new lines. I think this is ok because it's easy to convert to a format that ruby can deal with, but it would be great if ruby would recognise all these \r characters without any new lines and give a warning that there's probably an encoding problem.

For example, given this code:

hi "hello"[\r]
def hi(x)[\r]
puts x[\r]
end

instead of returning:

test.rb:1: syntax error, unexpected keyword_def, expecting end-of-input
end puts x
^

it would return

test.rb: Warning: Have you got the wrong line endings in this file? Both UNIX-style (\n) and Windows-style (\r\n) are recognised by ruby, but your file has something different.

Not really an urgent feature but it would be helpful in some cases. Shouldn't be too hard to implement

Actions

Also available in: Atom PDF

Like0
Like0Like0