title: "ISO-8859-1" Encoding in javascript
body: <p>I've created a base64 encoding <code>string</code> in the following format using C#. I want to create the same encoded string using JavaScript. </p>
  
  <pre><code>var isoEncoding = System.Text.Encoding.GetEncoding("ISO-8859-1");
  var a = isoEncoding.GetBytes(username + ":" + password);
  String encoded = System.Convert.ToBase64String(a);
  request.Headers.Add("Authorization", "Basic " + encoded);
  </code></pre>
  
  <p>Here I used <code>iconv</code> and try to get encoded <code>string</code> and it gives a differen encoded string. what can be the reason? </p>
  
  <pre><code>var str  = this.username+':'+this.password;
  var s = iconv.encode(str, 'ISO-8859-1');
  var a = btoa(s.toString()); 
  headers.append('Authorization', 'Basic ' + a);
  </code></pre>