title: How to urlencode data for curl command?
body: <p>I am trying to write a bash script for testing that takes a parameter and sends it through curl to web site.  I need to url encode the value to make sure that special characters are processed properly.  What is the best way to do this?  </p>
  
  <p>Here is my basic script so far:</p>
  
  <pre><code>#!/bin/bash
  host=${1:?'bad host'}
  value=$2
  shift
  shift
  curl -v -d "param=${value}" http://${host}/somepath $@
  </code></pre>