This project is archived and is in readonly mode.
ruby 1.9 and utf8 erb templates
Reported by Eugene Pimenov | February 5th, 2009 @ 04:39 AM | in 2.x
First patch:
irb(main):001:0> require 'erb'
=> true
irb(main):002:0> puts ERB.new('test').src
#coding:UTF-8
_erbout = ''; _erbout.concat "test"; _erbout.force_encoding(__ENCODING__)
=> nil
it forces encoding to ENCODING. ENCODING equals encoding of ruby file that executes that code. And in Rails this code is executed by actionpack/lib/action_view/renderable.rb.
Second patch:
- headers["Content-Length"] = body.size.to_s
+ headers["Content-Length"] = (body.respond_to?(:bytesize) ? body.bytesize : body.size).to_s
Content-length needs size in bytes, not in chars, so for 1.9 .size no longer valid.
Comments and changes to this ticket
-
Eugene Pimenov February 5th, 2009 @ 04:40 AM
- no changes were found...
-
DHH February 6th, 2009 @ 01:44 PM
- Assigned user set to Jeremy Kemper
-
Repository February 6th, 2009 @ 07:04 PM
- State changed from new to committed
(from [ae36fcedce1ffcf4f3331b444ea1779987c6615a]) Ruby 1.9 compat: call bytesize for content_length
[#1881 state:committed]
Signed-off-by: Jeremy Kemper jeremy@bitsweat.net http://github.com/rails/rails/co...
-
Repository February 6th, 2009 @ 07:04 PM
(from [b1c1e3deb7d752292abaff34ba66a3eae030d252]) Ruby 1.9 compat: change encoding of action_view/renderable to utf-8, so erb templates can use utf-8 properly
[#1881 state:committed]
Signed-off-by: Jeremy Kemper jeremy@bitsweat.net http://github.com/rails/rails/co...
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Referenced by
- 1881 ruby 1.9 and utf8 erb templates [#1881 state:committed]
- 1881 ruby 1.9 and utf8 erb templates [#1881 state:committed]