UPS using '®' in API responses, causing REXML::ParseException #164

hoffm opened this Issue Jun 10, 2014 · 1 comment


None yet

2 participants

hoffm commented Jun 10, 2014

I'm using ruby 1.9.3p545 and active_shipping 0.12.3.

UPS seems to have started including the '®' symbol in reporting activity of packages. It appears that this is causing an error when active_shipping tries to parse the API response.

Example shipment: 1ZW69Y250398445209


Calling find_tracking_info for this tracking number results in the following stack trace:

REXML::ParseException: #<REXML::ParseException: #<ArgumentError: invalid byte sequence in UTF-8>
/usr/lib64/ruby/1.9.1/rexml/source.rb:210:in `match'
/usr/lib64/ruby/1.9.1/rexml/source.rb:210:in `match'
/usr/lib64/ruby/1.9.1/rexml/parsers/baseparser.rb:419:in `pull_event'
/usr/lib64/ruby/1.9.1/rexml/parsers/baseparser.rb:183:in `pull'
/usr/lib64/ruby/1.9.1/rexml/parsers/treeparser.rb:22:in `parse'
/usr/lib64/ruby/1.9.1/rexml/document.rb:245:in `build'
/usr/lib64/ruby/1.9.1/rexml/document.rb:43:in `initialize'
/data/food52/shared/bundled_gems/ruby/1.9.1/gems/active_shipping-0.12.3/lib/active_shipping/shipping/carriers/ups.rb:323:in `new'
/data/food52/shared/bundled_gems/ruby/1.9.1/gems/active_shipping-0.12.3/lib/active_shipping/shipping/carriers/ups.rb:323:in `parse_tracking_response'
/data/food52/shared/bundled_gems/ruby/1.9.1/gems/active_shipping-0.12.3/lib/active_shipping/shipping/carriers/ups.rb:121:in `find_tracking_info'

I propose that active_shipping should sanitize the response before creating the REXML::Document, unless REXML provides a way of gracefully handling cases like these.


I ported UPS to use Nokogiri to parse XML. Can you see if this is still an issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment