title: Converting base64 encoded bytes to string different in Javascript and C#
body: <p>I have an image &amp; when I convert to <code>Base64</code> using <code>JavaScript</code> and <code>C#</code>, it gives me two different values. what is the reason for this? </p>
  
  <p><strong>JavaScript Code</strong></p>
  
  <pre><code>  function LoadSvg() {
              var main = document.getElementById('svgimg');
              var data = main.innerHTML;
              debugger;
              var base64blob = Base64.encode(data);
              alert(base64blob);
              var image2 = document.getElementById('Img2');
              image2.src = 'data:image/svg+xml;base64,' + base64blob;
          }
  </code></pre>
  
  <p><strong>C# code</strong></p>
  
  <pre><code>string val=litSvg.Text;
  byte[] arr = Encoding.UTF8.GetBytes(val);
  string toBaseVal = Convert.ToBase64String(arr);      
  ExternalHtml = 
     "&lt;img id=\"dfs\" src=\"data:image/svg+xml;base64," + toBaseVal + "\" /&gt;";
  </code></pre>
  
  <p>in JavaScript <code>main</code> value and c# <code>val</code> values are same. how this happens? if I need to same same value in java script out put, how can I do that?</p>
  
  <p><strong>Edit :</strong></p>
  
  <p>val value :</p>
  
  <pre><code>&lt;svg xmlns='http://www.w3.org/2000/svg' version='1.1' width='470px' height='310px'&gt;&lt;line x1='40' y1='10' x2='40' y2='250'style='stroke: rgb(0,0,0); stroke-width: 1' /&gt;...
  </code></pre>
  
  <p>main value :</p>
  
  <pre><code> &lt;svg id="svg-code" xmlns="http://www.w3.org/2000/svg" version="1.1" width="470px" height="310px"&gt; &lt;line x1="40" y1="10" x2="40" y2="250" style="stroke: rgb(0,0,0); stroke-width: 1"&gt;&lt;/line&gt;
  </code></pre>
  
  <p><strong>O/P values :</strong></p>
  
  <p>base64blob : CiAgICAgICAgICAgICAgICA8.....</p>
  
  <p>toBaseVal  : PHN2ZyB4bWxucz0naHR0cDov ....</p>