lib/rasti/web/render.rb in rasti-web-0.0.2 vs lib/rasti/web/render.rb in rasti-web-0.0.3

- old
+ new

@@ -16,29 +16,29 @@ extract_body(args) end def text(text, *args) respond_with extract_status(args), - extract_headers(args).merge('Content-Type' => 'text/plain'), + extract_headers(args).merge('Content-Type' => 'text/plain; charset=utf-8'), text end def html(html, *args) respond_with extract_status(args), - extract_headers(args).merge('Content-Type' => 'text/html'), + extract_headers(args).merge('Content-Type' => 'text/html; charset=utf-8'), html end def json(object, *args) respond_with extract_status(args), - extract_headers(args).merge('Content-Type' => 'application/json'), + extract_headers(args).merge('Content-Type' => 'application/json; charset=utf-8'), object.is_a?(String) ? object : JSON.dump(object) end def js(script, *args) respond_with extract_status(args), - extract_headers(args).merge('Content-Type' => 'application/javascript'), + extract_headers(args).merge('Content-Type' => 'application/javascript; charset=utf-8'), script end def file(filename, *args) content_type = MIME::Types.of(filename).first.content_type @@ -48,18 +48,18 @@ extract_headers(args).merge('Content-Type' => content_type), body end def partial(template, locals={}) - response['Content-Type'] = 'text/html' + response['Content-Type'] = 'text/html; charset=utf-8' response.write view_context.render(template, locals) end def layout(template=nil, &block) content = block.call if block layout = view_context.render(template || Web.default_layout) { content } - response['Content-Type'] = 'text/html' + response['Content-Type'] = 'text/html; charset=utf-8' response.write layout end def view(template, locals={}, layout_template=nil) layout(layout_template) { view_context.render template, locals } \ No newline at end of file