title: Ach processing adding special characters in file
body: <blockquote>
    <p>I have to generate ACH file(my code is below). whenever bank is processing this. it add some special characters in front of the file. Unable to figure out</p>
  </blockquote>
  
  <p>What can be the proper way to generate the ACH file having NACHA format, so that it can be processed without any faliure</p>
  
  <pre><code>try
              {
                  //Set this flag to fix the issue
                  ChoETLFrxBootstrap.IsSandboxEnvironment = false;
                  ChoNACHAConfiguration config = new ChoNACHAConfiguration();
                  config.DestinationBankRoutingNumber = "xxxxxxxxxx";                
                  config.OriginatingCompanyId = "xxxxxxxxxx";
                  config.DestinationBankName = ("SOME Bank").ToUpper();
                  config.OriginatingCompanyName = ("Organisation Name").ToUpper();
                  config.ReferenceCode = ("mgmt").ToUpper();
                  config.BlockingFactor = 10;
                  var unitowners = Achbll.GetUnitOwnerPaymentList(Dt).ToList();
                  var FileName = "ACH_" + ((DateTime.Now.ToString("dd-MM-yyy hh:mm:ss")).Replace(" ", "_").Replace(":", "_")) + ".txt";
                  var backpath = "~/CondoDocuments/DocumentLibrary/AchFiles/" + FileName;
                  var path = Server.MapPath(backpath); //HttpRuntime.AppDomainAppPath + backpath;
  
                  using (var fs = System.IO.File.Create(path))
                  {
                      fs.Close();
                      fs.Dispose();
                  }
  
                  using (var nachaWriter = new ChoNACHAWriter(path, config))
                  {
                      using (var bw2 = nachaWriter.CreateBatch(200, "PPD", "DIR DEBIT", DateTime.Now, DateTime.Now.AddDays(1), null, null, '1', null, null))
                      {
                          foreach (var owner in unitowners)
                          {
                              if (!string.IsNullOrEmpty(owner.AccountNo) &amp;&amp; !string.IsNullOrEmpty(owner.BankRoutingCode))
                              {
  
                                  var UA = Cipher.decrypt(owner.AccountNo);
                                  var BR = Cipher.decrypt(owner.BankRoutingCode);
                                  var Name = owner.UnitOwnerName.Split(' ');
                                  if (Name.Length &gt; 1)
                                  {
                                      using (var entry = bw2.CreateDebitEntryDetail(27, BR.ToString(), UA.ToString(), 5, " 18H00A " + owner.UnitNo.ToString(), (Name[1] + ", " + Name[0]).ToUpper().ToString()))
                                      {
                                          //entry.CheckDigit = '0';
                                      }
                                  }
                                  else
                                  {
                                      using (var entry = bw2.CreateDebitEntryDetail(
                                                                                      27,
                                                                                      BR.ToString(),
                                                                                      UA.ToString(),
                                                                                      new decimal(5.25),
                                                                                      " 18H00B " + owner.UnitNo.ToString(),
                                                                                      (Name[0]).ToUpper().ToString()))
  
                                      {
                                          //entry.CheckDigit = '0';
                                      }
                                  }
                              }
                          }
                      }
                  }
  
                  AchFiles obj = new AchFiles
                  {
                      FileName = FileName,
                      Path = "../CondoDocuments/DocumentLibrary/AchFiles/" + FileName
                  };
  
                  Achbll.AddAchFiles(obj);
  
              }
              catch (System.Exception ex)
              {
  
              }
  </code></pre>
  
  <blockquote>
    <p>I am attaching the screen shot of the processed data
    <a href="https://i.stack.imgur.com/qRJFF.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qRJFF.jpg" alt="enter image description here"></a></p>
  </blockquote>