This all looks correct. You simply have to correctly parse the LDIF
output.
See RFC 2849 for the details. And use a decent LDIF parser for your
favourite
scripting language and not some home-grown bash/sed/awk/whatever scripts which fail for such a simple thing.
I am not quite sure, if I understand it correctly. I made the ldif using slapcat. Slapcat used to Base64 encode the 1.3.6.1.4.1.1466.115.121.1.5 syntax. Now it doesn't do that anymore. But due to this change slapadd is not able to import this file. So I simply use slapcat and slapadd, but now slapadd fails. I am not using any other tools, only OpenLDAP tools. And if I only use OpenLDAP tools everything should work correctly, shouldn't it? That's why I think there is a bug in slapcat. But if you think slapcat works correctly I could also say: There is a bug in slapadd, because it can't import the ldif generated by slapcat.
Regards, Frank