aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/template.rb
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2011-11-16 21:37:10 +0000
committerJon Leighton <j@jonathanleighton.com>2011-11-16 21:38:06 +0000
commit3a6a10a36d9fdcc6de0f2a8e81c73001c1331072 (patch)
treeaab13cdbcbce9e53fb60059b1ca74f3411624e8d /actionpack/lib/action_view/template.rb
parent61228e9a0cafb5f0a8e4f2c24da36ef9261840fb (diff)
downloadrails-3a6a10a36d9fdcc6de0f2a8e81c73001c1331072.tar.gz
rails-3a6a10a36d9fdcc6de0f2a8e81c73001c1331072.tar.bz2
rails-3a6a10a36d9fdcc6de0f2a8e81c73001c1331072.zip
Switch from marshal format to plain text for the encoding conversions dump. This is for windows compatibility. Fixes #3644.
Diffstat (limited to 'actionpack/lib/action_view/template.rb')
-rw-r--r--actionpack/lib/action_view/template.rb13
1 files changed, 7 insertions, 6 deletions
diff --git a/actionpack/lib/action_view/template.rb b/actionpack/lib/action_view/template.rb
index fbc135c4a7..8d69880308 100644
--- a/actionpack/lib/action_view/template.rb
+++ b/actionpack/lib/action_view/template.rb
@@ -12,18 +12,19 @@ if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'ruby' && RUBY_VERSION == '1.9.3' &&
# able to find it (due to a bug).
#
# However, we don't know what conversions we may need to do a runtime. So we load up a
- # marshal-dumped structure which contains a pre-generated list of all the possible conversions,
+ # text file which contains a pre-generated list of all the possible conversions,
# and we load all of them.
#
# In my testing this increased the process size by about 3.9 MB (after the conversions array
# is GC'd) and took around 170ms to run, which seems acceptable for a workaround.
#
- # The script to dump the conversions is: https://gist.github.com/1342729
+ # The script to dump the conversions is: https://gist.github.com/1371499
- filename = File.join(File.dirname(__FILE__), 'data', 'encoding_conversions.dump')
- conversions = Marshal.load(File.read(filename))
- conversions.each do |from, to_array|
- to_array.each do |to|
+ filename = File.join(File.dirname(__FILE__), 'data', 'encoding_conversions.txt')
+ conversions = File.read(filename)
+ conversions.split("\n").map do |line|
+ from, to_array = line.split(':')
+ to_array.split(',').each do |to|
Encoding::Converter.new(from, to)
end
end