title: How to create a txt file from a string with exactly whats what is in the string?
body: <p>I have created a simple HTML file that has a textarea, two text input, and a button that when the button is clicked it downloads what is in the textarea with what is in the text input as the name. This has worked for me a very long time until I typed text with a #. When I put the # it would create the txt file with only the stuff before the #. This is the code for how I download it.</p>
  <pre class="lang-js prettyprint-override"><code>function generate() {
      var textToSave = document.getElementById('Input1').value;
      var hiddenElement = document.createElement('a');
  
      hiddenElement.href = 'data:attachment/text,' + encodeURI(textToSave);
      hiddenElement.target = '_blank';
      hiddenElement.download = document.getElementById('fileName').value+'.' + document.getElementById(&quot;fileExtension&quot;).value;
      hiddenElement.click();
  }
  </code></pre>
  <p>I can't use anything but the #, so I need a way for the file to keep all the text.</p>