From: Daniel Berger Date: 2006-06-18T12:00:19+09:00 Subject: Re: xmlrpc and charset=utf-8 --- Phil Tomson wrote: > I'm needed to interact with an XMLRPC server written > using the > xmlrpc-c library for C/C++. I was using Ruby 1.8.4 > and found that I > could not get a simple xmlrpc client written in Ruby > that would > communicate with the xmlrpc-c server. > > I kept getting the following error: > /usr/local/lib/ruby/1.8/xmlrpc/client.rb:547:in > `do_rpc': > HTTP-Error: 400 Bad Request (RuntimeError) > from > /usr/local/lib/ruby/1.8/xmlrpc/client.rb:420:in > `call2' > from > /usr/local/lib/ruby/1.8/xmlrpc/client.rb:410:in > `call' > from littleclient.rb:7 > > > I tried downgrading to Ruby 1.8.2 and it worked > fine. > > When I investigated the difference I found the > following in the > xmlrpc/client.rb file that comes with Ruby 1.8.4: > def do_rpc(request, async=false) > header = { > "User-Agent" => USER_AGENT, > "Content-Type" => "text/xml; > charset=utf-8", > "Content-Length" => request.size.to_s, > "Connection" => (async ? "close" : > "keep-alive") > } > > This differs from the client.rb included with Ruby > 1.8.2: > > def do_rpc(request, async=false) > header = { > "User-Agent" => USER_AGENT, > "Content-Type" => "text/xml ", > "Content-Length" => request.size.to_s, > "Connection" => (async ? "close" : > "keep-alive") > } > > so I changed the code in the 1.8.4 version of > client.rb to remove the > "charset=utf-8" - after that the ruby client > interacted fine with the > xmlrpc-c server. > > I'm wondering if utf-8 should be the default charset > for Ruby's xmlrpc > client implementation? Also, I'm wondering if > perhaps it could be > selectable by adding an accessor method to the > client to the Client > class? > > Phil Was this ever addressed? I vote for both a default of utf8 and an accessor method. Regards, Dan __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com