title: Solved: C# MemoryStream converted to byte array, then to base64 string removes RTL characters
body: <p>I am adding page numbers to a pdf file,</p>
  <p>It works correctly with english, but when I try to add hebrew text it ommits those letters.</p>
  <p>I assume the problem is with the encoding to base64, how do I solve this?</p>
  <p><strong>Code Example</strong></p>
  <pre><code>byte[] myBinary = File.ReadAllBytes(path);
  using (var reader = new PdfReader(myBinary))
  {
      using (var ms = new MemoryStream())
      {
          using (var stamper = new PdfStamper(reader, ms))
          {
              int PageCount = reader.NumberOfPages;
              for (int i = 1; i &lt;= PageCount; i++)
              {
                  ColumnText.ShowTextAligned(stamper.GetUnderContent(i),
          Element.ALIGN_CENTER, new Phrase(String.Format(&quot;{0} מתוך {1}&quot;, i, PageCount)), 297f, 15f, 0);
              }
          }
          myBinary = ms.ToArray();
      }
  }
  string base64EncodedPDF = System.Convert.ToBase64String(myBinary);
  return base64EncodedPDF;
  </code></pre>
  <p>In the front all I do is download the file.</p>
  <pre><code> $scope.open_letter = function (letter) {
     var _letter = myService.PrintLetter().then(function (data) {
         var pdfAsDataUri = &quot;data:application/pdf;base64,&quot; + data.data;
         var a = document.createElement(&quot;a&quot;);
         a.href = pdfAsDataUri;
         a.download = &quot;מכתב&quot; + &quot;.pdf&quot;;
         a.click();
  });
  }
  </code></pre>
  <p>The reason I am asking this question is because in English it works perfectly, but it just <strong>ommits</strong> the Hebrew letters, which is interesting- I would assume it would replace it with weird characters.</p>