Permalink
Browse files

force encoding to utf8 on tmeplate and helper

  • Loading branch information...
1 parent 551b17d commit fb2c2e083c8d36cb69caea6ac05868978b2d6f93 @zzak committed Mar 19, 2013
Showing with 2 additions and 7 deletions.
  1. +1 −1 lib/glorify/helpers.rb
  2. +1 −6 lib/glorify/template.rb
@@ -63,7 +63,7 @@ module Helpers
# Sinatra::Helpers</code> to your application.
def glorify text
Redcarpet::Markdown.new(Glorify::Renderer.new,
- Glorify::EXTENSIONS).render(text)
+ Glorify::EXTENSIONS).render(text.force_encoding('UTF-8'))
end
end
end
@@ -21,19 +21,14 @@ module Glorify
# markdown :a_view_with_code_blocks
# end
class Template < Tilt::Template
- def default_encoding
- 'UTF-8'
- end
-
def prepare # :nodoc:
@engine = Redcarpet::Markdown.new(Glorify::Renderer.new,
Glorify::EXTENSIONS)
@output = nil
end
def evaluate(scope, locals, &block) # :nodoc:
- @output ||= @engine.render(data)
- @output.force_encoding('UTF-8')
+ @output ||= @engine.render(data.force_encoding('UTF-8'))
end
end
end

0 comments on commit fb2c2e0

Please sign in to comment.