Unexpected results from roundtrip through ActiveResource to_xml/from_xml - string isn't the same?

I'm trying to figure out why I get a different string after a round-trip through to_xml/from_xml. I'm using edge rails, rev is 7921, and I see the same results on Windows and Linux.

Here's the code:

require File.dirname(__FILE__) + '/../config/boot' require RAILS_ROOT + '/config/environment'

class Foo < ActiveResource::Base   self.site = "http://localhost" end

f = Foo.new(:x => "\304") puts f.to_xml results = Hash.from_xml(f.to_xml) puts results.inspect puts "Value for character in original: #{f.x[0]}; " puts "Value for character after round-trip through xml: #{results['foo']['x'][0]}"

And here's the result:

<?xml version="1.0" encoding="UTF-8"?> <foo>   <x>&#196;</x> </foo> {"foo"=>{"x"=>"Ä"}} Value for character in original: 196; Value for character after round-trip through xml: 195

Shouldn't that last 195 be 196?