summaryrefslogtreecommitdiff
path: root/template/prelude.c.tmpl
diff options
context:
space:
mode:
Diffstat (limited to 'template/prelude.c.tmpl')
-rw-r--r--template/prelude.c.tmpl6
1 files changed, 5 insertions, 1 deletions
diff --git a/template/prelude.c.tmpl b/template/prelude.c.tmpl
index aa8b0c1fef..74f6c08da7 100644
--- a/template/prelude.c.tmpl
+++ b/template/prelude.c.tmpl
@@ -43,7 +43,10 @@ class Prelude
lineno = 0
result = [@preludes.size, @vpath.strip(filename), lines, sub]
@vpath.foreach(filename) do |line|
- line.force_encoding("ASCII-8BIT") if line.respond_to?(:force_encoding)
+ if line.respond_to?(:force_encoding)
+ enc = line.encoding
+ line.force_encoding("ASCII-8BIT")
+ end
line.rstrip!
lineno += 1
@preludes[filename] ||= result
@@ -71,6 +74,7 @@ class Prelude
orig
end
end
+ comment.force_encoding(enc) if enc and comment
lines << [line, comment]
end
result << (start_line || 1)