lib/rdoc/markup/preprocess.rb in rdoc-2.5.4 vs lib/rdoc/markup/preprocess.rb in rdoc-2.5.5
- old
+ new
@@ -44,10 +44,15 @@
##
# Include a file, indenting it correctly.
def include_file(name, indent)
if full_name = find_include_file(name) then
- content = File.read full_name
+ content = if defined?(Encoding) then
+ File.binread full_name
+ else
+ File.read full_name
+ end
+ # HACK determine content type and force encoding
content = content.sub(/\A# .*coding[=:].*$/, '').lstrip
# strip leading '#'s, but only if all lines start with them
if content =~ /^[^#]/ then
content.gsub(/^/, indent)