# XML Builder - problems with serialized ruby

**URL:** <https://www.ruby-forum.com/t/xml-builder-problems-with-serialized-ruby/166791>\
**Category:** Rails\
**Created:** [April 29, 2009, 4:45pm UTC](https://www.ruby-forum.com/t/xml-builder-problems-with-serialized-ruby/166791 "2009-04-29T16:45:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![goodieboy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/ecc23a/32.png) [@goodieboy](https://www.ruby-forum.com/u/goodieboy)\
**Post date:** [April 29, 2009, 4:45pm UTC](https://www.ruby-forum.com/t/xml-builder-problems-with-serialized-ruby/166791/1 "2009-04-29T16:45:29Z")

</div>

Hi,

I’m using the Builder gem to transform an array/hash that contains  
serialized ruby. Builder’s to\_xs method seems to mangle serialized  
ruby though. I can get around this by encoding/decoding with base 64,  
but that doesn’t seem like a good path to follow.

Builder is using this code for escaping:  
[http://intertwingly.net/stories/2005/09/28/xchar.rb](http://intertwingly.net/stories/2005/09/28/xchar.rb)

Any ideas on how to modify that, so serialized ruby will be escaped  
properly?

Thanks,  
Matt
