Skip to content
This repository has been archived by the owner on Jun 13, 2018. It is now read-only.

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

Open
hoffm opened this issue Jun 10, 2014 · 1 comment
Open

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

hoffm opened this issue Jun 10, 2014 · 1 comment

Comments

@hoffm
Copy link

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

Screenshot:

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.

@wvanbergen
Copy link
Contributor

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants