Skip to content

Commit

Permalink
Make sure encoding changes don't break 1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
wycats committed May 17, 2010
1 parent 821e15e commit 02c36cf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 3 additions & 1 deletion actionpack/lib/action_view/template/handlers/erb.rb
Expand Up @@ -7,7 +7,7 @@ module ActionView
class OutputBuffer < ActiveSupport::SafeBuffer class OutputBuffer < ActiveSupport::SafeBuffer
def initialize(*) def initialize(*)
super super
encode! encode! if encoding_aware?
end end


def <<(value) def <<(value)
Expand Down Expand Up @@ -106,6 +106,8 @@ def compile(template)
if !encoding && (template.source.encoding == Encoding::BINARY) if !encoding && (template.source.encoding == Encoding::BINARY)
raise WrongEncodingError.new(template_source, Encoding.default_external) raise WrongEncodingError.new(template_source, Encoding.default_external)
end end
else
erb = template.source.dup
end end


result = self.class.erb_implementation.new( result = self.class.erb_implementation.new(
Expand Down
10 changes: 6 additions & 4 deletions actionpack/test/template/template_test.rb
@@ -1,9 +1,11 @@
require "abstract_unit" require "abstract_unit"


# These are the normal settings that will be set up by Railties if "ruby".encoding_aware?
# TODO: Have these tests support other combinations of these values # These are the normal settings that will be set up by Railties
Encoding.default_internal = "UTF-8" # TODO: Have these tests support other combinations of these values
Encoding.default_external = "UTF-8" Encoding.default_internal = "UTF-8"
Encoding.default_external = "UTF-8"
end


class TestERBTemplate < ActiveSupport::TestCase class TestERBTemplate < ActiveSupport::TestCase
ERBHandler = ActionView::Template::Handlers::ERB ERBHandler = ActionView::Template::Handlers::ERB
Expand Down

0 comments on commit 02c36cf

Please sign in to comment.