Skip to content


Subversion checkout URL

You can clone with
Download ZIP


NoMethodError on rails xml builder + cache #2108

nanaya opened this Issue · 3 comments

3 participants


(and garbled characters without cache)

Demo application:

(pardon the gemfile requirements)

Start rails and visit /test.atom to reproduce the error. Also additionally visit /test2.atom to see how the character becomes garbled without cache.

### assuming rbx with RBXOPT=-X19
### with nodejs' node somewhere in PATH
cd /some/where
git clone
cd testutf8
rbx -S gem install bundler
rbx -S bundle install
rbx -S bundle exec rails s
### and then open/curl the aforementioned url - http://localhost:3000/test.atom etc

Notice that same variable rendered properly in html (/test.html).

No actual memcached server is required.


The following code is what the cache executes

# encoding: utf-8                                                                                                                                                        
s = '<?xml version="1.0" encoding="UTF-8"?>                                                                                                                              
<feed xml:lang="en-US" xmlns="">                                                                                                              
  <link rel="alternate" type="text/html" href=""/>                                                                                        
  <link rel="self" type="application/atom+xml" href=""/>                                                                         
f = s.slice!(0..-1)                                                                                                                                                      
puts f.inspect

The line causing the slice! is in actionpack. As it is building a Range there, I can't introduce nil as that would break.


The method missing error was fixed with 9653426, but the underlying string corruption still needs to be fixed.

The problem is that String#tr isn't encoding aware yet and replaces strings wrong.


Closing this one since the remaining problem of the invalid character is in issue #2157

@dbussink dbussink closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.