I'm working with a Ruby on Rails application that makes a client side API call to a 3rd party service. It then takes strings from the 3rd party API and generates URIs with them.
Unfortunately, Rails fails to parse some of the URIs due to encoding errors. I have tried running the strings through encodeURIComponent, but this does not resolve the issue.
Here is the error I get:
Processing ApplicationController#index (for 67.101.113.66 at 2010-08-12 23:24:55) [GET]
Parameters: {"name"=>"Camilo Andr\xE9s \xD1ustes", "recipient_id"=>"279"}
ArgumentError (invalid byte sequence in US-ASCII):
<internal:prelude>:8:in `synchronize'
/home/heroku_rack/lib/static_assets.rb:9:in `call'
/home/heroku_rack/lib/last_access.rb:25:in `call'
/home/heroku_rack/lib/date_header.rb:14:in `call'
thin (1.2.6) lib/thin/connection.rb:76:in `block in pre_process'
thin (1.2.6) lib/thin/connection.rb:74:in `catch'
thin (1.2.6) lib/thin/connection.rb:74:in `pre_process'
thin (1.2.6) lib/thin/connection.rb:57:in `process'
thin (1.2.6) lib/thin/connection.rb:42:in `receive_data'
eventmachine (0.12.10) lib/eventmachine.rb:256:in `run_machine'
eventmachine (0.12.10) lib/eventmachine.rb:256:in `run'
thin (1.2.6) lib/thin/backends/base.rb:57:in `start'
thin (1.2.6) lib/thin/server.rb:156:in `start'
thin (1.2.6) lib/thin/controllers/controller.rb:80:in `start'
thin (1.2.6) lib/thin/runner.rb:177:in `run_command'
thin (1.2.6) lib/thin/runner.rb:143:in `run!'
thin (1.2.6) bin/thin:6:in `<top (required)>'
/usr/ruby1.9.1/bin/thin:19:in `load'
/usr/ruby1.9.1/bin/thin:19:in `<main>'
How do I properly handle these strings as input for my application?