Open tomjoro opened 13 years ago
I used the send_message method to generate the SQS message. I noticed the header of the message like this: <?xml version="1.0"?>
maybe it should be this in the header... <?xml version="1.0" encoding="utf-8" ?>
Maybe I just can't find the setting...??
Default encoding in xml is utf-8. http://www.opentag.com/xfaq_enc.htm#enc_default
My guess is the text should be explicitly decoded as utf-8 (?? - I don't use ruby 1.9).
It is possible also that the responsible party is rexml - if it received a binary stream as input it should attempt to figure out the encoding and then decode the binary stream appropriately.
Hi, had this issue with 2.1.0 and S3 when using european characters (São Paulo, for example) which I was able to fix by forcing the encoding in RightAWSParser.
A message with the S3 name was passed via SQS.
Wondering if I did something wrong? Was there someway to set the encoding or is this an issue?
I fixed the problem by forcing the encoding by monkey patching RightAwsParser.
module RightAws class RightAWSParser def parse(xml_text, params={}) ... xml_text.force_encoding 'utf-8' # This is the magic line... REXML::Document.parse_stream(xml_text, self)
This was the error :
/Users/tom/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/rexml/source.rb:212:in
match' /Users/tom/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/rexml/source.rb:212:in
match' /Users/tom/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/rexml/parsers/baseparser.rb:425:inpull' /Users/tom/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/rexml/parsers/streamparser.rb:16:in
parse' /Users/tom/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/rexml/document.rb:204:inparse_stream' /Users/tom/.rvm/gems/ruby-1.9.2-p290@dashwire/gems/right_aws-2.1.0/lib/awsbase/right_awsbase.rb:1098:in
parse' /Users/tom/.rvm/gems/ruby-1.9.2-p290@dashwire/gems/right_aws-2.1.0/lib/awsbase/right_awsbase.rb:536:inblock in request_info_impl' /Users/tom/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/benchmark.rb:295:in
measure' /Users/tom/.rvm/gems/ruby-1.9.2-p290@dashwire/gems/right_aws-2.1.0/lib/awsbase/benchmark_fix.rb:30:inadd!' /Users/tom/.rvm/gems/ruby-1.9.2-p290@dashwire/gems/right_aws-2.1.0/lib/awsbase/right_awsbase.rb:536:in
request_info_impl' /Users/tom/.rvm/gems/ruby-1.9.2-p290@dashwire/gems/right_aws-2.1.0/lib/sqs/right_sqs_gen2_interface.rb:142:inrequest_info' /Users/tom/.rvm/gems/ruby-1.9.2-p290@dashwire/gems/right_aws-2.1.0/lib/sqs/right_sqs_gen2_interface.rb:289:in
receive_message' /Users/tom/.rvm/gems/ruby-1.9.2-p290@dashwire/gems/right_aws-2.1.0/lib/sqs/right_sqs_gen2.rb:170:inreceive_messages' /Users/tom/.rvm/gems/ruby-1.9.2-p290@dashwire/gems/right_aws-2.1.0/lib/sqs/right_sqs_gen2.rb:185:in
receive' /Users/tom/git/sqs_util/lib/sqs_util/base.rb:75:in `get_one_message'