Why do I have to encode a string when reading and writing form inputs using jquery?
<p>I am programatically reading data from a text input using standard Jquery like this:</p>

<pre><code>  var listName = $('#list').val();
</code></pre>

<p>and then I am adding a hidden input field into a form before submitting like this:</p>

<pre><code>var myForm = $("#myForm);
myForm.append('&lt;input type="hidden" name="List" value="' + listName + '" /&gt;');
</code></pre>

<p>In one example,  the value in the field is:</p>

<pre><code>Key Date &amp; Times
</code></pre>

<p>so on the UI it looks like this</p>

<pre><code>&lt;input type="hidden" name="MyList" value="Key Date &amp; Times" /&gt;
</code></pre>

<p>when I submit the form using:</p>

<pre><code>var myForm = $("#myForm);
myForm.submit();
</code></pre>

<p>and check it on the asp.net-mvc server side i only see:</p>

<pre><code>Key Date 
</code></pre>

<p>being sent over.  After some research, it was suggested to write some javascript to run the value through:</p>

<pre><code>encodeURIComponent()
</code></pre>

<p>After doing that and taking a look at the server side, I now see: </p>

<pre><code>Key%20Date%20%26%20Times
</code></pre>

<p>How can I convert that back to </p>

<pre><code>Key Date &amp; Times
</code></pre>

<p>on the C# asp.net-mvc server side?  Or Seperately, if I am doing something wrong on the client side, please let me if you have any suggestions.</p>

<p>My main question is why do i have to worry about encoding the value of a hidden input box in a form.  I would have thought this would be taken care of for you.</p>