Skip to content

Commit

Permalink
Rectify the line delimeters immediately after reading a file for wind…
Browse files Browse the repository at this point in the history
…ows. Issue #87
  • Loading branch information
drbrain committed Dec 8, 2011
1 parent c50f187 commit da5a8c8
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 10 deletions.
1 change: 1 addition & 0 deletions lib/rdoc/encoding.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ module RDoc::Encoding

def self.read_file filename, encoding, force_transcode = false
content = open filename, "rb" do |f| f.read end
content.gsub!("\r\n", "\n") if RUBY_PLATFORM =~ /mswin|mingw/

utf8 = content.sub!(/\A\xef\xbb\xbf/, '')

Expand Down
10 changes: 0 additions & 10 deletions test/test_rdoc_markup_pre_process.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,6 @@ def test_include_file
contents of a string.
EXPECTED

# FIXME 1.9 fix on windoze
# preprocessor uses binread, so line endings are \r\n
expected.gsub!("\n", "\r\n") if
RUBY_VERSION < "1.9.3" && RUBY_PLATFORM =~ /mswin|mingw/

assert_equal expected, content
end

Expand All @@ -74,11 +69,6 @@ def test_include_file_encoding_incompatible

expected = "?\n"

# FIXME 1.9 fix on windoze
# preprocessor uses binread, so line endings are \r\n
expected.gsub!("\n", "\r\n") if
RUBY_VERSION < "1.9.3" && RUBY_PLATFORM =~ /mswin|mingw/

assert_equal expected, content
end

Expand Down

0 comments on commit da5a8c8

Please sign in to comment.