History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: JRUBY-2140
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Daniel Berger
Votes: 0
Watchers: 3
Operations

If you were logged in you would be able to see more operations.
JRuby

IO.readlines returns native line endings

Created: 19/Feb/08 12:47 PM   Updated: 21/Feb/08 05:59 AM
Component/s: Core Classes/Modules
Affects Version/s: JRuby 1.1RC2
Fix Version/s: None

Time Tracking:
Not Specified

Environment: Windows XP Pro, Java 1.5
Issue Links:
Related
 


 Description  « Hide
On MS Windows the IO.readlines method is retaining the "\r\n" line endings. In MRI the line ending is always "\n". To demonstrate, create a simple text file in notepad and run this:
IO.readlines('test.txt').each{ |line|
   p line
   p line.length
}

With MRI:

C:\>ruby readlines_test.rb
"Line one\n"
9
"Line two\n"
9

With JRuby

C:\>jruby readlines_test.rb
"Line one\r\n"
10
"Line two\r\n"
10


 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Vladimir Sizikov - 21/Feb/08 05:59 AM
Related and possibly duplicates the JRUBY-61 issue.