title: Ldapsearch and base64 encoding of non ASCII values
body: <p>If the database contains non ASCII data like (Lehtelä) , the Ldapsearch returns it as an base64 encoded (:: TGVodGVsw6Q=) .
  I followed this blog, for decoding it(<a href="https://lurchi.wordpress.com/2009/11/03/ldapsearch-and-base64-encoding/" rel="nofollow noreferrer">https://lurchi.wordpress.com/2009/11/03/ldapsearch-and-base64-encoding/</a>)</p>
  
  <p>It only helps if the base64 is a single line value, how to handle it if value spans across multiple lines.</p>
  
  <pre><code> ldapsearch -x -H ldap://76.656.23.56 -D cn=admin -w abc -b "o=my_comp" -s sub -LLL 'mail=mail@gmail.com'  sn nrfAssignedResources | un64
  
  dn: cn=SBOSTRO2,ou=Employees,ou=Active,ou=Identities,ou=Meta,o=VCC
  base64: invalid input
  nrfAssignedResources:: "cn=VCCBIZ GPO 0100 account,cn=ResourceDef"
   zLGNuPVJvbGVDb25maWcsY249QXBwQ29uZmlnLGNuPVVBLGNuPURyaXZlclNldCxvdT1TeXN0ZW0s
   bz1WQ0MjMiM8YXNzaWdubWsjdfahgsgacgfacxfg sahhagsvgcagjMyMzZaPC9zdGFydF90bT48c
   mVxX3RtPjIwMTQwMTI3MDYzMjM2WjwvcmVxX3RtPjxpbnN0LWd1aWQ+ZGM5M2ZkODRjYmQ3NGY3MG
   JjM2VmZjRlODAyZDdlMjE8L2luc3QtZ3VpZD48cmVxPmNuPUpBU1BMVU5ELG91PUVtcGxveWVlcyx
   W50Pg==
  sn:: "Boström "
  </code></pre>
  
  <p>As you can see here, because <strong>sn</strong> has only single  line its complete("Boström") and <strong>nrfAssignedResources</strong> value is multiple line, only first line is decoded not the rest.
  the AWK code is available in the link above.</p>